This patchset add the necessary changes to support guests whose page
size is larger than 4K. And the main architecture which we develop this
for is ARM64 (also it's the architecture that I use to test this
feature).
Previous version:
v1: https://lore.kernel.org/lkml/[email protected]/
v2: https://lore.kernel.org/lkml/[email protected]
v3: https://lore.kernel.org/lkml/[email protected]/
Changes since v3:
* Fix a bug that ringbuffer sizes are not page-aligned when
PAGE_SIZE = 16k. Drop the Acked-by and Reviewed-by tags for
those patches accordingly.
* Code improvement as per suggestion from Michael Kelley.
I've done some tests with PAGE_SIZE=64k and PAGE_SIZE=16k configurations
on ARM64 guests (with Michael's patchset[1] for ARM64 Hyper-V guest
support), everything worked fine ;-)
Looking forwards to comments and suggestions!
Regards,
Boqun
[1]: https://lore.kernel.org/lkml/[email protected]/
Boqun Feng (11):
Drivers: hv: vmbus: Always use HV_HYP_PAGE_SIZE for gpadl
Drivers: hv: vmbus: Move __vmbus_open()
Drivers: hv: vmbus: Introduce types of GPADL
Drivers: hv: Use HV_HYP_PAGE in hv_synic_enable_regs()
Drivers: hv: vmbus: Move virt_to_hvpfn() to hyperv header
hv: hyperv.h: Introduce some hvpfn helper functions
hv_netvsc: Use HV_HYP_PAGE_SIZE for Hyper-V communication
Input: hyperv-keyboard: Use VMBUS_RING_SIZE() for ringbuffer sizes
HID: hyperv: Use VMBUS_RING_SIZE() for ringbuffer sizes
Driver: hv: util: Use VMBUS_RING_SIZE() for ringbuffer sizes
scsi: storvsc: Support PAGE_SIZE larger than 4K
drivers/hid/hid-hyperv.c | 4 +-
drivers/hv/channel.c | 461 ++++++++++++++++----------
drivers/hv/hv.c | 4 +-
drivers/hv/hv_util.c | 11 +-
drivers/input/serio/hyperv-keyboard.c | 4 +-
drivers/net/hyperv/netvsc.c | 2 +-
drivers/net/hyperv/netvsc_drv.c | 46 +--
drivers/net/hyperv/rndis_filter.c | 13 +-
drivers/scsi/storvsc_drv.c | 56 +++-
include/linux/hyperv.h | 68 +++-
10 files changed, 442 insertions(+), 227 deletions(-)
--
2.28.0
There will be more places other than vmbus where we need to calculate
the Hyper-V page PFN from a virtual address, so move virt_to_hvpfn() to
hyperv generic header.
Signed-off-by: Boqun Feng <[email protected]>
Reviewed-by: Michael Kelley <[email protected]>
---
drivers/hv/channel.c | 13 -------------
include/linux/hyperv.h | 15 +++++++++++++++
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 45267b6d069e..fbdda9938039 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -22,19 +22,6 @@
#include "hyperv_vmbus.h"
-static unsigned long virt_to_hvpfn(void *addr)
-{
- phys_addr_t paddr;
-
- if (is_vmalloc_addr(addr))
- paddr = page_to_phys(vmalloc_to_page(addr)) +
- offset_in_page(addr);
- else
- paddr = __pa(addr);
-
- return paddr >> HV_HYP_PAGE_SHIFT;
-}
-
/*
* hv_gpadl_size - Return the real size of a gpadl, the size that Hyper-V uses
*
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 9c19149c0e1a..83456dc181a8 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -14,6 +14,7 @@
#include <uapi/linux/hyperv.h>
+#include <linux/mm.h>
#include <linux/types.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
@@ -23,6 +24,7 @@
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
#include <linux/reciprocal_div.h>
+#include <asm/hyperv-tlfs.h>
#define MAX_PAGE_BUFFER_COUNT 32
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
@@ -1676,4 +1678,17 @@ struct hyperv_pci_block_ops {
extern struct hyperv_pci_block_ops hvpci_block_ops;
+static inline unsigned long virt_to_hvpfn(void *addr)
+{
+ phys_addr_t paddr;
+
+ if (is_vmalloc_addr(addr))
+ paddr = page_to_phys(vmalloc_to_page(addr)) +
+ offset_in_page(addr);
+ else
+ paddr = __pa(addr);
+
+ return paddr >> HV_HYP_PAGE_SHIFT;
+}
+
#endif /* _HYPERV_H */
--
2.28.0
On Wed, Sep 16, 2020 at 11:48:06AM +0800, Boqun Feng wrote:
> This patchset add the necessary changes to support guests whose page
> size is larger than 4K. And the main architecture which we develop this
> for is ARM64 (also it's the architecture that I use to test this
> feature).
>
> Previous version:
> v1: https://lore.kernel.org/lkml/[email protected]/
> v2: https://lore.kernel.org/lkml/[email protected]
> v3: https://lore.kernel.org/lkml/[email protected]/
>
> Changes since v3:
>
> * Fix a bug that ringbuffer sizes are not page-aligned when
> PAGE_SIZE = 16k. Drop the Acked-by and Reviewed-by tags for
> those patches accordingly.
>
> * Code improvement as per suggestion from Michael Kelley.
>
> I've done some tests with PAGE_SIZE=64k and PAGE_SIZE=16k configurations
> on ARM64 guests (with Michael's patchset[1] for ARM64 Hyper-V guest
> support), everything worked fine ;-)
>
> Looking forwards to comments and suggestions!
>
> Regards,
> Boqun
>
> [1]: https://lore.kernel.org/lkml/[email protected]/
>
> Boqun Feng (11):
> Drivers: hv: vmbus: Always use HV_HYP_PAGE_SIZE for gpadl
> Drivers: hv: vmbus: Move __vmbus_open()
> Drivers: hv: vmbus: Introduce types of GPADL
> Drivers: hv: Use HV_HYP_PAGE in hv_synic_enable_regs()
> Drivers: hv: vmbus: Move virt_to_hvpfn() to hyperv header
> hv: hyperv.h: Introduce some hvpfn helper functions
> hv_netvsc: Use HV_HYP_PAGE_SIZE for Hyper-V communication
> Input: hyperv-keyboard: Use VMBUS_RING_SIZE() for ringbuffer sizes
> HID: hyperv: Use VMBUS_RING_SIZE() for ringbuffer sizes
> Driver: hv: util: Use VMBUS_RING_SIZE() for ringbuffer sizes
> scsi: storvsc: Support PAGE_SIZE larger than 4K
Series applied to hyperv-next.
I also replaced the tabs with spaces in the commit messages of patch 8
through patch 10.
Wei.