lkml.org 
[lkml]   [2015]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] drivers:hv Remove old MMIO management code
Date
This patch removes the code that is no longer necessary
after the first two patches in this series have been applied.
It exposed a static range of memory-mapped I/O space gleaned
from the ACPI namespace, in a way that worked for a single
paravirtual device, the video frame buffer.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
---
drivers/hv/vmbus_drv.c | 25 -------------------------
drivers/video/fbdev/hyperv_fb.c | 27 ++++++++++++++-------------
include/linux/hyperv.h | 2 --
3 files changed, 14 insertions(+), 40 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 5d85ef3..2722e63 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -44,12 +44,6 @@ static struct tasklet_struct msg_dpc;
static struct completion probe_event;
static int irq;

-struct resource hyperv_mmio = {
- .name = "hyperv mmio",
- .flags = IORESOURCE_MEM,
-};
-EXPORT_SYMBOL_GPL(hyperv_mmio);
-
static int vmbus_exists(void)
{
if (hv_acpi_dev == NULL)
@@ -555,7 +549,6 @@ static void vmbus_device_release(struct device *device)
kfree(hv_dev);
}

-
/* The one and only one */
static struct bus_type hv_bus = {
.name = "vmbus",
@@ -931,11 +924,6 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
case ACPI_RESOURCE_TYPE_IRQ:
irq = res->data.irq.interrupts[0];
break;
-
- case ACPI_RESOURCE_TYPE_ADDRESS64:
- hyperv_mmio.start = res->data.address64.address.minimum;
- hyperv_mmio.end = res->data.address64.address.maximum;
- break;
}

return AE_OK;
@@ -953,20 +941,7 @@ static int vmbus_acpi_add(struct acpi_device *device)

if (ACPI_FAILURE(result))
goto acpi_walk_err;
- /*
- * The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
- * has the mmio ranges. Get that.
- */
- if (device->parent) {
- result = acpi_walk_resources(device->parent->handle,
- METHOD_NAME__CRS,
- vmbus_walk_resources, NULL);

- if (ACPI_FAILURE(result))
- goto acpi_walk_err;
- if (hyperv_mmio.start && hyperv_mmio.end)
- request_resource(&iomem_resource, &hyperv_mmio);
- }
ret_val = 0;

acpi_walk_err:
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 69ea59b..161157e 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -675,26 +675,22 @@ static void hvfb_get_option(struct fb_info *info)


/* Get framebuffer memory from Hyper-V video pci space */
-static int hvfb_getmem(struct fb_info *info)
+static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
{
struct hvfb_par *par = info->par;
struct pci_dev *pdev = NULL;
void __iomem *fb_virt;
+ struct resource *res;
int gen2vm = efi_enabled(EFI_BOOT);
int ret;

- par->mem.name = KBUILD_MODNAME;
- par->mem.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
if (gen2vm) {
- ret = allocate_resource(&hyperv_mmio, &par->mem,
- screen_fb_size,
- 0, -1,
- screen_fb_size,
- NULL, NULL);
- if (ret != 0) {
- pr_err("Unable to allocate framebuffer memory\n");
+ res = pnp_get_resource(hdev->pnp_dev, IORESOURCE_MEM, 0);
+ if (!res) {
+ pr_err("Unable to fetch FB claim\n");
return -ENODEV;
}
+ par->mem = *res;
} else {
pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
@@ -707,6 +703,8 @@ static int hvfb_getmem(struct fb_info *info)
pci_resource_len(pdev, 0) < screen_fb_size)
goto err1;

+ par->mem.name = KBUILD_MODNAME;
+ par->mem.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
par->mem.end = pci_resource_end(pdev, 0);
par->mem.start = par->mem.end - screen_fb_size + 1;
ret = request_resource(&pdev->resource[0], &par->mem);
@@ -747,7 +745,8 @@ static int hvfb_getmem(struct fb_info *info)
err3:
iounmap(fb_virt);
err2:
- release_resource(&par->mem);
+ if (!gen2vm)
+ release_resource(&par->mem);
err1:
if (!gen2vm)
pci_dev_put(pdev);
@@ -759,9 +758,11 @@ err1:
static void hvfb_putmem(struct fb_info *info)
{
struct hvfb_par *par = info->par;
+ int gen2vm = efi_enabled(EFI_BOOT);

iounmap(info->screen_base);
- release_resource(&par->mem);
+ if (!gen2vm)
+ release_resource(&par->mem);
}


@@ -792,7 +793,7 @@ static int hvfb_probe(struct hv_device *hdev,
goto error1;
}

- ret = hvfb_getmem(info);
+ ret = hvfb_getmem(hdev, info);
if (ret) {
pr_err("No memory for framebuffer\n");
goto error2;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 796cc32..993ea5f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1221,8 +1221,6 @@ int hv_vss_init(struct hv_util_service *);
void hv_vss_deinit(void);
void hv_vss_onchannelcallback(void *);

-extern struct resource hyperv_mmio;
-
/*
* Negotiated version with the Host.
*/
--
1.9.1


\
 
 \ /
  Last update: 2015-02-17 19:41    [W:0.137 / U:1.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site