From: Jake Oshins <jakeo@microsoft.com>
To: rafael.j.wysocki@intel.com, gregkh@linuxfoundation.org,
kys@microsoft.com, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
vkuznets@redhat.com
Cc: Jake Oshins <jakeo@microsoft.com>
Subject: [PATCH 3/3] drivers:hv Remove old MMIO management code
Date: Tue, 17 Feb 2015 11:41:51 -0800 [thread overview]
Message-ID: <1424202111-14461-3-git-send-email-jakeo@microsoft.com> (raw)
In-Reply-To: <1424202111-14461-1-git-send-email-jakeo@microsoft.com>
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
next prev parent reply other threads:[~2015-02-17 18:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 19:41 [PATCH 1/3] drivers:pnp Add support for descendants claiming memory address space Jake Oshins
2015-02-17 19:41 ` [PATCH 2/3] drivers:hv Convert VMBus and its descendants to PnP Jake Oshins
2015-02-18 10:24 ` Dan Carpenter
2015-02-18 16:55 ` Jake Oshins
2015-02-17 19:41 ` Jake Oshins [this message]
2015-03-02 3:33 ` [PATCH 1/3] drivers:pnp Add support for descendants claiming memory address space Greg KH
2015-03-02 3:36 ` KY Srinivasan
2015-03-05 23:03 ` Rafael J. Wysocki
2015-03-10 22:10 ` Jake Oshins
2015-03-11 0:34 ` Rafael J. Wysocki
2015-03-19 19:21 ` Jake Oshins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424202111-14461-3-git-send-email-jakeo@microsoft.com \
--to=jakeo@microsoft.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=rafael.j.wysocki@intel.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox