* RE: [Patch v4 1/2] PCI: hv: Decouple the func definition in hv_dr_state from VSP message
From: Long Li @ 2020-02-06 23:48 UTC (permalink / raw)
To: Long Li, longli@linuxonhyperv.com, KY Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Lorenzo Pieralisi, Andrew Murray,
Bjorn Helgaas, linux-hyperv@vger.kernel.org,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <SN6PR2101MB10234B91D7748441CA18A361CE0C0@SN6PR2101MB1023.namprd21.prod.outlook.com>
Hi guys,
Ping again...
Please take a look at these two patches.
Thanks
Long
>Subject: RE: [Patch v4 1/2] PCI: hv: Decouple the func definition in hv_dr_state
>from VSP message
>
>Hi Lorenzo,
>
>Can you take a look at this patch?
>
>Thanks
>
>Long
>
>>Subject: [Patch v4 1/2] PCI: hv: Decouple the func definition in
>>hv_dr_state from VSP message
>>
>>From: Long Li <longli@microsoft.com>
>>
>>hv_dr_state is used to find present PCI devices on the bus. The
>>structure reuses struct pci_function_description from VSP message to describe
>a device.
>>
>>To prepare support for pci_function_description v2, decouple this
>>dependence in hv_dr_state so it can work with both v1 and v2 VSP messages.
>>
>>There is no functionality change.
>>
>>Signed-off-by: Long Li <longli@microsoft.com>
>>Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>>---
>>Changes
>>v2: Changed some spaces to tabs, changed failure code to -ENOMEM
>>v3: Revised comment for function hv_pci_devices_present(), reformatted
>>patch title
>>v4: Fixed spelling
>>
>> drivers/pci/controller/pci-hyperv.c | 101 +++++++++++++++++++---------
>> 1 file changed, 70 insertions(+), 31 deletions(-)
>>
>>diff --git a/drivers/pci/controller/pci-hyperv.c
>>b/drivers/pci/controller/pci- hyperv.c index f1f300218fab..3b3e1967cf08
>>100644
>>--- a/drivers/pci/controller/pci-hyperv.c
>>+++ b/drivers/pci/controller/pci-hyperv.c
>>@@ -507,10 +507,24 @@ struct hv_dr_work {
>> struct hv_pcibus_device *bus;
>> };
>>
>>+struct hv_pcidev_description {
>>+ u16 v_id; /* vendor ID */
>>+ u16 d_id; /* device ID */
>>+ u8 rev;
>>+ u8 prog_intf;
>>+ u8 subclass;
>>+ u8 base_class;
>>+ u32 subsystem_id;
>>+ union win_slot_encoding win_slot;
>>+ u32 ser; /* serial number */
>>+ u32 flags;
>>+ u16 virtual_numa_node;
>>+};
>>+
>> struct hv_dr_state {
>> struct list_head list_entry;
>> u32 device_count;
>>- struct pci_function_description func[0];
>>+ struct hv_pcidev_description func[0];
>> };
>>
>> enum hv_pcichild_state {
>>@@ -527,7 +541,7 @@ struct hv_pci_dev {
>> refcount_t refs;
>> enum hv_pcichild_state state;
>> struct pci_slot *pci_slot;
>>- struct pci_function_description desc;
>>+ struct hv_pcidev_description desc;
>> bool reported_missing;
>> struct hv_pcibus_device *hbus;
>> struct work_struct wrk;
>>@@ -1862,7 +1876,7 @@ static void q_resource_requirements(void
>>*context, struct pci_response *resp,
>> * Return: Pointer to the new tracking struct
>> */
>> static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus,
>>- struct pci_function_description *desc)
>>+ struct hv_pcidev_description *desc)
>> {
>> struct hv_pci_dev *hpdev;
>> struct pci_child_message *res_req;
>>@@ -1973,7 +1987,7 @@ static void pci_devices_present_work(struct
>>work_struct *work) {
>> u32 child_no;
>> bool found;
>>- struct pci_function_description *new_desc;
>>+ struct hv_pcidev_description *new_desc;
>> struct hv_pci_dev *hpdev;
>> struct hv_pcibus_device *hbus;
>> struct list_head removed;
>>@@ -2090,43 +2104,26 @@ static void pci_devices_present_work(struct
>>work_struct *work)
>> put_hvpcibus(hbus);
>> kfree(dr);
>> }
>>-
>> /**
>>- * hv_pci_devices_present() - Handles list of new children
>>+ * hv_pci_start_relations_work() - Queue work to start device
>>+ discovery
>> * @hbus: Root PCI bus, as understood by this driver
>>- * @relations: Packet from host listing children
>>+ * @dr: The list of children returned from host
>> *
>>- * This function is invoked whenever a new list of devices for
>>- * this bus appears.
>>+ * Return: 0 on success, -errno on failure
>> */
>>-static void hv_pci_devices_present(struct hv_pcibus_device *hbus,
>>- struct pci_bus_relations *relations)
>>+static int hv_pci_start_relations_work(struct hv_pcibus_device *hbus,
>>+ struct hv_dr_state *dr)
>> {
>>- struct hv_dr_state *dr;
>> struct hv_dr_work *dr_wrk;
>>- unsigned long flags;
>> bool pending_dr;
>>+ unsigned long flags;
>>
>> dr_wrk = kzalloc(sizeof(*dr_wrk), GFP_NOWAIT);
>> if (!dr_wrk)
>>- return;
>>-
>>- dr = kzalloc(offsetof(struct hv_dr_state, func) +
>>- (sizeof(struct pci_function_description) *
>>- (relations->device_count)), GFP_NOWAIT);
>>- if (!dr) {
>>- kfree(dr_wrk);
>>- return;
>>- }
>>+ return -ENOMEM;
>>
>> INIT_WORK(&dr_wrk->wrk, pci_devices_present_work);
>> dr_wrk->bus = hbus;
>>- dr->device_count = relations->device_count;
>>- if (dr->device_count != 0) {
>>- memcpy(dr->func, relations->func,
>>- sizeof(struct pci_function_description) *
>>- dr->device_count);
>>- }
>>
>> spin_lock_irqsave(&hbus->device_list_lock, flags);
>> /*
>>@@ -2144,6 +2141,47 @@ static void hv_pci_devices_present(struct
>>hv_pcibus_device *hbus,
>> get_hvpcibus(hbus);
>> queue_work(hbus->wq, &dr_wrk->wrk);
>> }
>>+
>>+ return 0;
>>+}
>>+
>>+/**
>>+ * hv_pci_devices_present() - Handle list of new children
>>+ * @hbus: Root PCI bus, as understood by this driver
>>+ * @relations: Packet from host listing children
>>+ *
>>+ * Process a new list of devices on the bus. The list of devices is
>>+ * discovered by VSP and sent to us via VSP message PCI_BUS_RELATIONS,
>>+ * whenever a new list of devices for this bus appears.
>>+ */
>>+static void hv_pci_devices_present(struct hv_pcibus_device *hbus,
>>+ struct pci_bus_relations *relations) {
>>+ struct hv_dr_state *dr;
>>+ int i;
>>+
>>+ dr = kzalloc(offsetof(struct hv_dr_state, func) +
>>+ (sizeof(struct hv_pcidev_description) *
>>+ (relations->device_count)), GFP_NOWAIT);
>>+
>>+ if (!dr)
>>+ return;
>>+
>>+ dr->device_count = relations->device_count;
>>+ for (i = 0; i < dr->device_count; i++) {
>>+ dr->func[i].v_id = relations->func[i].v_id;
>>+ dr->func[i].d_id = relations->func[i].d_id;
>>+ dr->func[i].rev = relations->func[i].rev;
>>+ dr->func[i].prog_intf = relations->func[i].prog_intf;
>>+ dr->func[i].subclass = relations->func[i].subclass;
>>+ dr->func[i].base_class = relations->func[i].base_class;
>>+ dr->func[i].subsystem_id = relations->func[i].subsystem_id;
>>+ dr->func[i].win_slot = relations->func[i].win_slot;
>>+ dr->func[i].ser = relations->func[i].ser;
>>+ }
>>+
>>+ if (hv_pci_start_relations_work(hbus, dr))
>>+ kfree(dr);
>> }
>>
>> /**
>>@@ -3018,7 +3056,7 @@ static void hv_pci_bus_exit(struct hv_device *hdev)
>> struct pci_packet teardown_packet;
>> u8 buffer[sizeof(struct pci_message)];
>> } pkt;
>>- struct pci_bus_relations relations;
>>+ struct hv_dr_state *dr;
>> struct hv_pci_compl comp_pkt;
>> int ret;
>>
>>@@ -3030,8 +3068,9 @@ static void hv_pci_bus_exit(struct hv_device *hdev)
>> return;
>>
>> /* Delete any children which might still exist. */
>>- memset(&relations, 0, sizeof(relations));
>>- hv_pci_devices_present(hbus, &relations);
>>+ dr = kzalloc(sizeof(*dr), GFP_KERNEL);
>>+ if (dr && hv_pci_start_relations_work(hbus, dr))
>>+ kfree(dr);
>>
>> ret = hv_send_resources_released(hdev);
>> if (ret)
>>--
>>2.17.1
^ permalink raw reply
* [PATCH net] hv_netvsc: Fix XDP refcnt for synthetic and VF NICs
From: Haiyang Zhang @ 2020-02-06 22:01 UTC (permalink / raw)
To: sashal, linux-hyperv, netdev
Cc: haiyangz, kys, sthemmin, olaf, vkuznets, davem, linux-kernel
The caller of XDP_SETUP_PROG has already incremented refcnt in
__bpf_prog_get(), so drivers should only increment refcnt by
num_queues - 1.
To fix the issue, update netvsc_xdp_set() to add the correct number
to refcnt.
Hold a refcnt in netvsc_xdp_set()’s other caller, netvsc_attach().
And, do the same in netvsc_vf_setxdp(). Otherwise, every time when VF is
removed and added from the host side, the refcnt will be decreased by one,
which may cause page fault when unloading xdp program.
Fixes: 351e1581395f ("hv_netvsc: Add XDP support")
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
drivers/net/hyperv/netvsc_bpf.c | 13 +++++++++++--
drivers/net/hyperv/netvsc_drv.c | 5 ++++-
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_bpf.c b/drivers/net/hyperv/netvsc_bpf.c
index 20adfe5..b866110 100644
--- a/drivers/net/hyperv/netvsc_bpf.c
+++ b/drivers/net/hyperv/netvsc_bpf.c
@@ -120,7 +120,7 @@ int netvsc_xdp_set(struct net_device *dev, struct bpf_prog *prog,
}
if (prog)
- bpf_prog_add(prog, nvdev->num_chn);
+ bpf_prog_add(prog, nvdev->num_chn - 1);
for (i = 0; i < nvdev->num_chn; i++)
rcu_assign_pointer(nvdev->chan_table[i].bpf_prog, prog);
@@ -136,6 +136,7 @@ int netvsc_vf_setxdp(struct net_device *vf_netdev, struct bpf_prog *prog)
{
struct netdev_bpf xdp;
bpf_op_t ndo_bpf;
+ int ret;
ASSERT_RTNL();
@@ -148,10 +149,18 @@ int netvsc_vf_setxdp(struct net_device *vf_netdev, struct bpf_prog *prog)
memset(&xdp, 0, sizeof(xdp));
+ if (prog)
+ bpf_prog_inc(prog);
+
xdp.command = XDP_SETUP_PROG;
xdp.prog = prog;
- return ndo_bpf(vf_netdev, &xdp);
+ ret = ndo_bpf(vf_netdev, &xdp);
+
+ if (ret && prog)
+ bpf_prog_put(prog);
+
+ return ret;
}
static u32 netvsc_xdp_query(struct netvsc_device *nvdev)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 8fc71bd..65e12cb 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1059,9 +1059,12 @@ static int netvsc_attach(struct net_device *ndev,
prog = dev_info->bprog;
if (prog) {
+ bpf_prog_inc(prog);
ret = netvsc_xdp_set(ndev, prog, NULL, nvdev);
- if (ret)
+ if (ret) {
+ bpf_prog_put(prog);
goto err1;
+ }
}
/* In any case device is now ready */
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Hyper-V: Drop Sasha Levin from the Hyper-V maintainers
From: Sasha Levin @ 2020-02-05 21:32 UTC (permalink / raw)
To: linux-hyperv; +Cc: sthemmin, haiyangz, kys, mikelley, jamorris, Sasha Levin
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9ed8bb8a1f5f..92cd55dfabe5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7732,7 +7732,6 @@ Hyper-V CORE AND DRIVERS
M: "K. Y. Srinivasan" <kys@microsoft.com>
M: Haiyang Zhang <haiyangz@microsoft.com>
M: Stephen Hemminger <sthemmin@microsoft.com>
-M: Sasha Levin <sashal@kernel.org>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
L: linux-hyperv@vger.kernel.org
S: Supported
--
2.20.1
^ permalink raw reply related
* RE: [bug report] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
From: Wei Hu @ 2020-02-05 11:33 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-hyperv@vger.kernel.org
In-Reply-To: <20200205080733.GU11068@kadam>
> -----Original Message-----
> > Thanks for reporting this. Would you let me know how I can reproduce
> > this warning or Error message? The build on my side runs fine without such
> message.
>
> Hm... Sorry, I never publish this Smatch check. I should do that.
> Anyway HCH explains the rules a bit in this email:
>
> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.or
> g%2Flkml%2F2019%2F6%2F17%2F155&data=02%7C01%7Cweh%40micro
> soft.com%7Cff5687dc7bb648623d3708d7aa127a4b%7C72f988bf86f141af91a
> b2d7cd011db47%7C1%7C0%7C637164868648450097&sdata=0%2B8Jwe
> 1A%2FtOW0LqF8t2hqymWuzZjVtUxBIKgMyOQdFc%3D&reserved=0
>
I see. This is virtual frame buffer device on Hyper-V. It would not get address from
vmap or ioremap. On the other hand, if dma_alloc_coherent() returns address without
page backing, this driver will blow even without calling virt_to_phys.
Dma_alloc_coherent() is the recommended interface to allocate large contiguous
physical memory, in which case this call is doing so. I think you can ignore this
in your check.
Thanks,
Wei
^ permalink raw reply
* Re: [bug report] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
From: Dan Carpenter @ 2020-02-05 8:07 UTC (permalink / raw)
To: Wei Hu; +Cc: linux-hyperv@vger.kernel.org
In-Reply-To: <SG2P153MB0380F76124DEE4F3728C056DBB020@SG2P153MB0380.APCP153.PROD.OUTLOOK.COM>
On Wed, Feb 05, 2020 at 07:21:31AM +0000, Wei Hu wrote:
> Hello Dan,
>
> > -----Original Message----->
> > Hello Wei Hu,
> >
> > The patch 3a6fb6c4255c: "video: hyperv: hyperv_fb: Use physical memory for
> > fb on HyperV Gen 1 VMs." from Dec 9, 2019, leads to the following static
> > checker warning:
> >
> > drivers/video/fbdev/hyperv_fb.c:991 hvfb_get_phymem()
> > error: 'vmem' came from dma_alloc_coherent() so we can't do
> > virt_to_phys()
> >
> > drivers/video/fbdev/hyperv_fb.c
> > 960 static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
> > 961 unsigned int request_size)
> > 962 {
> > 963 struct page *page = NULL;
> > 964 dma_addr_t dma_handle;
> > 965 void *vmem;
> > 966 phys_addr_t paddr = 0;
> > 967 unsigned int order = get_order(request_size);
> > 968
> > 969 if (request_size == 0)
> > 970 return -1;
> > 971
> > 972 if (order < MAX_ORDER) {
> > 973 /* Call alloc_pages if the size is less than 2^MAX_ORDER */
> > 974 page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
> > 975 if (!page)
> > 976 return -1;
> > 977
> > 978 paddr = (page_to_pfn(page) << PAGE_SHIFT);
> > 979 } else {
> > 980 /* Allocate from CMA */
> > 981 hdev->device.coherent_dma_mask = DMA_BIT_MASK(64);
> > 982
> > 983 vmem = dma_alloc_coherent(&hdev->device,
> > 984 round_up(request_size, PAGE_SIZE),
> > 985 &dma_handle,
> > 986 GFP_KERNEL | __GFP_NOWARN);
> > 987
> > 988 if (!vmem)
> > 989 return -1;
> > 990
> > 991 paddr = virt_to_phys(vmem);
> >
> > Pretty straight forward that the static checker is right but I can't give you any
> > hints how to fix it.
> >
>
> Thanks for reporting this. Would you let me know how I can reproduce this warning or
> Error message? The build on my side runs fine without such message.
Hm... Sorry, I never publish this Smatch check. I should do that.
Anyway HCH explains the rules a bit in this email:
https://lkml.org/lkml/2019/6/17/155
regards,
dan carpenter
^ permalink raw reply
* RE: [bug report] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
From: Wei Hu @ 2020-02-05 7:21 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-hyperv@vger.kernel.org
In-Reply-To: <20200205054359.ynzdaq6lalb2sv7w@kili.mountain>
Hello Dan,
> -----Original Message----->
> Hello Wei Hu,
>
> The patch 3a6fb6c4255c: "video: hyperv: hyperv_fb: Use physical memory for
> fb on HyperV Gen 1 VMs." from Dec 9, 2019, leads to the following static
> checker warning:
>
> drivers/video/fbdev/hyperv_fb.c:991 hvfb_get_phymem()
> error: 'vmem' came from dma_alloc_coherent() so we can't do
> virt_to_phys()
>
> drivers/video/fbdev/hyperv_fb.c
> 960 static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
> 961 unsigned int request_size)
> 962 {
> 963 struct page *page = NULL;
> 964 dma_addr_t dma_handle;
> 965 void *vmem;
> 966 phys_addr_t paddr = 0;
> 967 unsigned int order = get_order(request_size);
> 968
> 969 if (request_size == 0)
> 970 return -1;
> 971
> 972 if (order < MAX_ORDER) {
> 973 /* Call alloc_pages if the size is less than 2^MAX_ORDER */
> 974 page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
> 975 if (!page)
> 976 return -1;
> 977
> 978 paddr = (page_to_pfn(page) << PAGE_SHIFT);
> 979 } else {
> 980 /* Allocate from CMA */
> 981 hdev->device.coherent_dma_mask = DMA_BIT_MASK(64);
> 982
> 983 vmem = dma_alloc_coherent(&hdev->device,
> 984 round_up(request_size, PAGE_SIZE),
> 985 &dma_handle,
> 986 GFP_KERNEL | __GFP_NOWARN);
> 987
> 988 if (!vmem)
> 989 return -1;
> 990
> 991 paddr = virt_to_phys(vmem);
>
> Pretty straight forward that the static checker is right but I can't give you any
> hints how to fix it.
>
Thanks for reporting this. Would you let me know how I can reproduce this warning or
Error message? The build on my side runs fine without such message.
Thanks,
Wei
^ permalink raw reply
* [bug report] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
From: Dan Carpenter @ 2020-02-05 5:43 UTC (permalink / raw)
To: weh; +Cc: linux-hyperv
Hello Wei Hu,
The patch 3a6fb6c4255c: "video: hyperv: hyperv_fb: Use physical
memory for fb on HyperV Gen 1 VMs." from Dec 9, 2019, leads to the
following static checker warning:
drivers/video/fbdev/hyperv_fb.c:991 hvfb_get_phymem()
error: 'vmem' came from dma_alloc_coherent() so we can't do virt_to_phys()
drivers/video/fbdev/hyperv_fb.c
960 static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
961 unsigned int request_size)
962 {
963 struct page *page = NULL;
964 dma_addr_t dma_handle;
965 void *vmem;
966 phys_addr_t paddr = 0;
967 unsigned int order = get_order(request_size);
968
969 if (request_size == 0)
970 return -1;
971
972 if (order < MAX_ORDER) {
973 /* Call alloc_pages if the size is less than 2^MAX_ORDER */
974 page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
975 if (!page)
976 return -1;
977
978 paddr = (page_to_pfn(page) << PAGE_SHIFT);
979 } else {
980 /* Allocate from CMA */
981 hdev->device.coherent_dma_mask = DMA_BIT_MASK(64);
982
983 vmem = dma_alloc_coherent(&hdev->device,
984 round_up(request_size, PAGE_SIZE),
985 &dma_handle,
986 GFP_KERNEL | __GFP_NOWARN);
987
988 if (!vmem)
989 return -1;
990
991 paddr = virt_to_phys(vmem);
Pretty straight forward that the static checker is right but I can't
give you any hints how to fix it.
992 }
993
994 return paddr;
995 }
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 1/3] PCI: hv: Move hypercall related definitions into tlfs header
From: Boqun Feng @ 2020-02-04 2:22 UTC (permalink / raw)
To: Andrew Murray
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Sasha Levin, Lorenzo Pieralisi, Stephen Hemminger, Haiyang Zhang,
x86, Michael Kelley, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
Bjorn Helgaas, Andrew Murray, Thomas Gleixner, K. Y. Srinivasan
In-Reply-To: <20200203092525.GC20189@big-machine>
On Mon, Feb 03, 2020 at 09:25:25AM +0000, Andrew Murray wrote:
> On Mon, Feb 03, 2020 at 01:03:11PM +0800, Boqun Feng wrote:
> > Currently HVCALL_RETARGET_INTERRUPT and HV_PARTITION_ID_SELF are defined
> > in pci-hyperv.c. However, similar to other hypercall related definitions
> > , it makes more sense to put them in the tlfs header file.
>
> Nit: please keep the comma attached to the previous word - even if that
> means you need to move the word with it to the next line to maintain line
> limits.
>
> >
> > Besides, these definitions are arch-dependent, so for the support of
> > virtual PCI on non-x86 archs in the future, move them into arch-specific
> > tlfs header file.
> >
> > Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> > ---
> > arch/x86/include/asm/hyperv-tlfs.h | 3 +++
> > drivers/pci/controller/pci-hyperv.c | 6 ------
> > 2 files changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> > index 5f10f7f2098d..739bd89226a5 100644
> > --- a/arch/x86/include/asm/hyperv-tlfs.h
> > +++ b/arch/x86/include/asm/hyperv-tlfs.h
> > @@ -376,6 +376,7 @@ struct hv_tsc_emulation_status {
> > #define HVCALL_SEND_IPI_EX 0x0015
> > #define HVCALL_POST_MESSAGE 0x005c
> > #define HVCALL_SIGNAL_EVENT 0x005d
> > +#define HVCALL_RETARGET_INTERRUPT 0x007e
> > #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
> > #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
> >
> > @@ -405,6 +406,8 @@ enum HV_GENERIC_SET_FORMAT {
> > HV_GENERIC_SET_ALL,
> > };
> >
> > +#define HV_PARTITION_ID_SELF ((u64)-1)
> > +
> > #define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0)
> > #define HV_HYPERCALL_FAST_BIT BIT(16)
> > #define HV_HYPERCALL_VARHEAD_OFFSET 17
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > index 9977abff92fc..aacfcc90d929 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -406,12 +406,6 @@ struct pci_eject_response {
> >
> > static int pci_ring_size = (4 * PAGE_SIZE);
> >
> > -/*
> > - * Definitions or interrupt steering hypercall.
> > - */
> > -#define HV_PARTITION_ID_SELF ((u64)-1)
> > -#define HVCALL_RETARGET_INTERRUPT 0x7e
> > -
>
> Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>
>
Thanks! I will fix the comma thing and add your Reviewed-by in next
version.
Regards,
Boqun
> > struct hv_interrupt_entry {
> > u32 source; /* 1 for MSI(-X) */
> > u32 reserved1;
> > --
> > 2.24.1
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
From: Boqun Feng @ 2020-02-04 2:13 UTC (permalink / raw)
To: Thomas Gleixner
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, x86, Lorenzo Pieralisi, Andrew Murray,
Bjorn Helgaas
In-Reply-To: <87d0av20nj.fsf@nanos.tec.linutronix.de>
On Mon, Feb 03, 2020 at 03:41:52PM +0100, Thomas Gleixner wrote:
> Boqun Feng <boqun.feng@gmail.com> writes:
> > /*
> > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> > index 6b79515abb82..3bdaa3b6e68f 100644
> > --- a/arch/x86/include/asm/mshyperv.h
> > +++ b/arch/x86/include/asm/mshyperv.h
> > @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> > static inline void hv_apic_init(void) {}
> > #endif
> >
> > +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> > +do { \
> > + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> > +} while (0)
>
> Any reason why this needs to be a macro? inlines are preferrred. They
Making it an inline function will require #include <linux/msi.h> in
mshyperv.h, which I was trying to avoid. But now it seems pointless. I
will make it an inline in next version.
Regards,
Boqun
> are typesafe and readable.
>
> Thanks,
>
> tglx
^ permalink raw reply
* Re: [GIT PULL] Hyper-V commits for v5.6
From: pr-tracker-bot @ 2020-02-03 15:15 UTC (permalink / raw)
To: Sasha Levin
Cc: Linus Torvalds, linux-kernel, linux-hyperv, kys, sthemmin,
linux-kernel
In-Reply-To: <20200203022747.7473A205F4@mail.kernel.org>
The pull request you sent on Sun, 02 Feb 2020 21:27:46 -0500:
> git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git tags/hyperv-next-signed
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d0fa9250317ff6e92a1397ebf7cf4d83014f38a6
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ permalink raw reply
* Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
From: Thomas Gleixner @ 2020-02-03 14:41 UTC (permalink / raw)
To: Boqun Feng, linux-pci, linux-hyperv, linux-kernel,
linux-arm-kernel
Cc: Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, x86, Lorenzo Pieralisi, Andrew Murray,
Bjorn Helgaas, Boqun Feng
In-Reply-To: <20200203050313.69247-4-boqun.feng@gmail.com>
Boqun Feng <boqun.feng@gmail.com> writes:
> /*
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index 6b79515abb82..3bdaa3b6e68f 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> static inline void hv_apic_init(void) {}
> #endif
>
> +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> +do { \
> + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> +} while (0)
Any reason why this needs to be a macro? inlines are preferrred. They
are typesafe and readable.
Thanks,
tglx
^ permalink raw reply
* Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
From: Boqun Feng @ 2020-02-03 14:35 UTC (permalink / raw)
To: Andrew Murray
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas
In-Reply-To: <20200203095140.GE20189@big-machine>
On Mon, Feb 03, 2020 at 09:51:40AM +0000, Andrew Murray wrote:
> On Mon, Feb 03, 2020 at 01:03:13PM +0800, Boqun Feng wrote:
> > Add a new structure (hv_msi_entry), which is also defined int tlfs, to
>
> s/int/in the/ ?
>
Good catch, will fix.
> > describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is
> > needed because its layout may be different from architecture to
> > architecture.
> >
> > Also add a new generic interface hv_set_msi_address_from_desc() to allow
> > different archs to set the msi address from msi_desc.
> >
> > No functional change, only preparation for the future support of virtual
> > PCI on non-x86 architectures.
> >
> > Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> > ---
> > arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++--
> > arch/x86/include/asm/mshyperv.h | 5 +++++
> > drivers/pci/controller/pci-hyperv.c | 4 ++--
> > 3 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> > index 4a76e442481a..953b3ad38746 100644
> > --- a/arch/x86/include/asm/hyperv-tlfs.h
> > +++ b/arch/x86/include/asm/hyperv-tlfs.h
> > @@ -912,11 +912,18 @@ struct hv_partition_assist_pg {
> > u32 tlb_lock_count;
> > };
> >
> > +union hv_msi_entry {
> > + u64 as_uint64;
> > + struct {
> > + u32 address;
> > + u32 data;
> > + } __packed;
> > +};
> > +
> > struct hv_interrupt_entry {
> > u32 source; /* 1 for MSI(-X) */
> > u32 reserved1;
> > - u32 address;
> > - u32 data;
> > + union hv_msi_entry msi_entry;
> > } __packed;
> >
> > /*
> > diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> > index 6b79515abb82..3bdaa3b6e68f 100644
> > --- a/arch/x86/include/asm/mshyperv.h
> > +++ b/arch/x86/include/asm/mshyperv.h
> > @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> > static inline void hv_apic_init(void) {}
> > #endif
> >
> > +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> > +do { \
> > + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> > +} while (0)
>
> Given that this is a single statement, is there really a need for the do ; while(0) ?
>
I choose to use do ; while (0) because I don't want code like the
following to be able to compile:
hv_set_msi_address_from_desc(...) /* semicolon is missing */
a = b;
But now think more about this, I think it's probably better to define
this as a function..
>
> > +
> > #else /* CONFIG_HYPERV */
> > static inline void hyperv_init(void) {}
> > static inline void hyperv_setup_mmu_ops(void) {}
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > index 0d9b74503577..2240f2b3643e 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data)
> > memset(params, 0, sizeof(*params));
> > params->partition_id = HV_PARTITION_ID_SELF;
> > params->int_entry.source = 1; /* MSI(-X) */
> > - params->int_entry.address = msi_desc->msg.address_lo;
> > - params->int_entry.data = msi_desc->msg.data;
> > + hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc);
> > + params->int_entry.msi_entry.data = msi_desc->msg.data;
>
> If the layout may differ, then don't we also need a wrapper for data?
>
On x86 hv_msi_entry is:
{
u32 address;
u32 data;
}
and on ARM64 it is:
{
u64 address;
u32 data;
u32 reserved;
}
So currently, setting msi_entry.data doesn't need a wrapper for
different archs. But now you mention it, probably a better way is to
provide a wrapper hv_set_msi_entry_from_desc(), which sets both address
and data instead of hv_set_msi_address_from_desc().
Thanks for looking into the whole patchset!
Regards,
Boqun
> Thanks,
>
> Andrew Murray
>
> > params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
> > (hbus->hdev->dev_instance.b[4] << 16) |
> > (hbus->hdev->dev_instance.b[7] << 8) |
> > --
> > 2.24.1
> >
^ permalink raw reply
* Re: [PATCH v2 2/3] PCI: hv: Move retarget related structures into tlfs header
From: Boqun Feng @ 2020-02-03 14:09 UTC (permalink / raw)
To: Andrew Murray
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas
In-Reply-To: <20200203094118.GD20189@big-machine>
On Mon, Feb 03, 2020 at 09:41:18AM +0000, Andrew Murray wrote:
> On Mon, Feb 03, 2020 at 01:03:12PM +0800, Boqun Feng wrote:
> > Currently, retarget_msi_interrupt and other structures it relys on are
> > defined in pci-hyperv.c. However, those structures are actually defined
> > in Hypervisor Top-Level Functional Specification [1] and may be
> > different in sizes of fields or layout from architecture to
> > architecture. Therefore, this patch moves those definitions into x86's
>
> Nit: Rather than 'Therefore, this patch moves ...' - how about 'Let's move
> ...'?
>
> > tlfs header file to support virtual PCI on non-x86 architectures in the
> > future.
> >
> > Besides, while I'm at it, rename retarget_msi_interrupt to
>
> Nit: 'Besides, while I'm at it' - this type of wording describes what
> *you've* done rather than what the patch is doing. You could replace
> that quoted text with 'Additionally, '
>
> > hv_retarget_msi_interrupt for the consistent name convention, also
>
> Nit: s/name/naming
>
Thanks for the suggestion on wording ;-)
> > mirroring the name in TLFS.
> >
> > [1]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
> >
> > Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> > ---
> > arch/x86/include/asm/hyperv-tlfs.h | 31 ++++++++++++++++++++++++++
> > drivers/pci/controller/pci-hyperv.c | 34 ++---------------------------
> > 2 files changed, 33 insertions(+), 32 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> > index 739bd89226a5..4a76e442481a 100644
> > --- a/arch/x86/include/asm/hyperv-tlfs.h
> > +++ b/arch/x86/include/asm/hyperv-tlfs.h
> > @@ -911,4 +911,35 @@ struct hv_tlb_flush_ex {
> > struct hv_partition_assist_pg {
> > u32 tlb_lock_count;
> > };
> > +
> > +struct hv_interrupt_entry {
> > + u32 source; /* 1 for MSI(-X) */
> > + u32 reserved1;
> > + u32 address;
> > + u32 data;
> > +} __packed;
>
> Why have you added __packed here? There is no mention of this change in the
> commit log? Is it needed?
>
I'm simply following the convention of hyperv-tlfs.h: most of the
structures have this "__packed" attribute. I personally don't think this
attribute is necessary, but I was afraid that I was missing something
subtle. So a question for folks working on Hyper-V: why we need this
attribute on TLFS-defined structures? Most of those will have no
difference with or without this attribute, IIUC.
> > +
> > +/*
> > + * flags for hv_device_interrupt_target.flags
> > + */
> > +#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
> > +#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
> > +
> > +struct hv_device_interrupt_target {
> > + u32 vector;
> > + u32 flags;
> > + union {
> > + u64 vp_mask;
> > + struct hv_vpset vp_set;
> > + };
> > +} __packed;
>
> Same here.
>
> > +
> > +/* HvRetargetDeviceInterrupt hypercall */
> > +struct hv_retarget_device_interrupt {
> > + u64 partition_id;
>
> Why drop the 'self' comment?
>
Good catch, TLFS does say this field must be 'self'. I will add it in
next version.
> > + u64 device_id;
> > + struct hv_interrupt_entry int_entry;
> > + u64 reserved2;
> > + struct hv_device_interrupt_target int_target;
> > +} __packed __aligned(8);
> > #endif
> > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> > index aacfcc90d929..0d9b74503577 100644
> > --- a/drivers/pci/controller/pci-hyperv.c
> > +++ b/drivers/pci/controller/pci-hyperv.c
> > @@ -406,36 +406,6 @@ struct pci_eject_response {
> >
> > static int pci_ring_size = (4 * PAGE_SIZE);
> >
> > -struct hv_interrupt_entry {
> > - u32 source; /* 1 for MSI(-X) */
> > - u32 reserved1;
> > - u32 address;
> > - u32 data;
> > -};
> > -
> > -/*
> > - * flags for hv_device_interrupt_target.flags
> > - */
> > -#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
> > -#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
> > -
> > -struct hv_device_interrupt_target {
> > - u32 vector;
> > - u32 flags;
> > - union {
> > - u64 vp_mask;
> > - struct hv_vpset vp_set;
> > - };
> > -};
> > -
> > -struct retarget_msi_interrupt {
> > - u64 partition_id; /* use "self" */
> > - u64 device_id;
> > - struct hv_interrupt_entry int_entry;
> > - u64 reserved2;
> > - struct hv_device_interrupt_target int_target;
> > -} __packed __aligned(8);
> > -
> > /*
> > * Driver specific state.
> > */
> > @@ -482,7 +452,7 @@ struct hv_pcibus_device {
> > struct workqueue_struct *wq;
> >
> > /* hypercall arg, must not cross page boundary */
> > - struct retarget_msi_interrupt retarget_msi_interrupt_params;
> > + struct hv_retarget_device_interrupt retarget_msi_interrupt_params;
> >
> > /*
> > * Don't put anything here: retarget_msi_interrupt_params must be last
> > @@ -1178,7 +1148,7 @@ static void hv_irq_unmask(struct irq_data *data)
> > {
> > struct msi_desc *msi_desc = irq_data_get_msi_desc(data);
> > struct irq_cfg *cfg = irqd_cfg(data);
> > - struct retarget_msi_interrupt *params;
> > + struct hv_retarget_device_interrupt *params;
>
> pci-hyperv.c also makes use of retarget_msi_interrupt_lock - it's really clear
> from this name what it protects, however your rename now makes this more
> confusing.
>
> Likewise there is a comment in hv_pci_probe that refers to
> retarget_msi_interrupt_params which is now stale.
>
But 'retarget_msi_interrupt_params' is the name of field in
hv_pcibus_device, so is 'retarget_msi_interrupt_lock'. And what I change
is the name of type. I believe people can tell the relationship from
the name of the fields, and the comment of hv_pci_probe actually refers
to the field rather than the type.
> It may be helpful to rename hv_retarget_device_interrupt for consistency with
> the docs - however please make sure you catch all the references - I'd suggest
> that the move and the rename are in different patches.
>
If the renaming requires a lot of work (e.g. need to change multiple
references), I will follow your suggestion. But seems it's not the case
for this renaming.
Regards,
Boqun
> Thanks,
>
> Andrew Murray
>
> > struct hv_pcibus_device *hbus;
> > struct cpumask *dest;
> > cpumask_var_t tmp;
> > --
> > 2.24.1
> >
^ permalink raw reply
* Re: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
From: Andrew Murray @ 2020-02-03 9:51 UTC (permalink / raw)
To: Boqun Feng
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas
In-Reply-To: <20200203050313.69247-4-boqun.feng@gmail.com>
On Mon, Feb 03, 2020 at 01:03:13PM +0800, Boqun Feng wrote:
> Add a new structure (hv_msi_entry), which is also defined int tlfs, to
s/int/in the/ ?
> describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is
> needed because its layout may be different from architecture to
> architecture.
>
> Also add a new generic interface hv_set_msi_address_from_desc() to allow
> different archs to set the msi address from msi_desc.
>
> No functional change, only preparation for the future support of virtual
> PCI on non-x86 architectures.
>
> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> ---
> arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++--
> arch/x86/include/asm/mshyperv.h | 5 +++++
> drivers/pci/controller/pci-hyperv.c | 4 ++--
> 3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 4a76e442481a..953b3ad38746 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -912,11 +912,18 @@ struct hv_partition_assist_pg {
> u32 tlb_lock_count;
> };
>
> +union hv_msi_entry {
> + u64 as_uint64;
> + struct {
> + u32 address;
> + u32 data;
> + } __packed;
> +};
> +
> struct hv_interrupt_entry {
> u32 source; /* 1 for MSI(-X) */
> u32 reserved1;
> - u32 address;
> - u32 data;
> + union hv_msi_entry msi_entry;
> } __packed;
>
> /*
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index 6b79515abb82..3bdaa3b6e68f 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
> static inline void hv_apic_init(void) {}
> #endif
>
> +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
> +do { \
> + (msi_entry)->address = (msi_desc)->msg.address_lo; \
> +} while (0)
Given that this is a single statement, is there really a need for the do ; while(0) ?
> +
> #else /* CONFIG_HYPERV */
> static inline void hyperv_init(void) {}
> static inline void hyperv_setup_mmu_ops(void) {}
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 0d9b74503577..2240f2b3643e 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data)
> memset(params, 0, sizeof(*params));
> params->partition_id = HV_PARTITION_ID_SELF;
> params->int_entry.source = 1; /* MSI(-X) */
> - params->int_entry.address = msi_desc->msg.address_lo;
> - params->int_entry.data = msi_desc->msg.data;
> + hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc);
> + params->int_entry.msi_entry.data = msi_desc->msg.data;
If the layout may differ, then don't we also need a wrapper for data?
Thanks,
Andrew Murray
> params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
> (hbus->hdev->dev_instance.b[4] << 16) |
> (hbus->hdev->dev_instance.b[7] << 8) |
> --
> 2.24.1
>
^ permalink raw reply
* Re: [PATCH v2 2/3] PCI: hv: Move retarget related structures into tlfs header
From: Andrew Murray @ 2020-02-03 9:41 UTC (permalink / raw)
To: Boqun Feng
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas
In-Reply-To: <20200203050313.69247-3-boqun.feng@gmail.com>
On Mon, Feb 03, 2020 at 01:03:12PM +0800, Boqun Feng wrote:
> Currently, retarget_msi_interrupt and other structures it relys on are
> defined in pci-hyperv.c. However, those structures are actually defined
> in Hypervisor Top-Level Functional Specification [1] and may be
> different in sizes of fields or layout from architecture to
> architecture. Therefore, this patch moves those definitions into x86's
Nit: Rather than 'Therefore, this patch moves ...' - how about 'Let's move
...'?
> tlfs header file to support virtual PCI on non-x86 architectures in the
> future.
>
> Besides, while I'm at it, rename retarget_msi_interrupt to
Nit: 'Besides, while I'm at it' - this type of wording describes what
*you've* done rather than what the patch is doing. You could replace
that quoted text with 'Additionally, '
> hv_retarget_msi_interrupt for the consistent name convention, also
Nit: s/name/naming
> mirroring the name in TLFS.
>
> [1]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
>
> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> ---
> arch/x86/include/asm/hyperv-tlfs.h | 31 ++++++++++++++++++++++++++
> drivers/pci/controller/pci-hyperv.c | 34 ++---------------------------
> 2 files changed, 33 insertions(+), 32 deletions(-)
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 739bd89226a5..4a76e442481a 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -911,4 +911,35 @@ struct hv_tlb_flush_ex {
> struct hv_partition_assist_pg {
> u32 tlb_lock_count;
> };
> +
> +struct hv_interrupt_entry {
> + u32 source; /* 1 for MSI(-X) */
> + u32 reserved1;
> + u32 address;
> + u32 data;
> +} __packed;
Why have you added __packed here? There is no mention of this change in the
commit log? Is it needed?
> +
> +/*
> + * flags for hv_device_interrupt_target.flags
> + */
> +#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
> +#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
> +
> +struct hv_device_interrupt_target {
> + u32 vector;
> + u32 flags;
> + union {
> + u64 vp_mask;
> + struct hv_vpset vp_set;
> + };
> +} __packed;
Same here.
> +
> +/* HvRetargetDeviceInterrupt hypercall */
> +struct hv_retarget_device_interrupt {
> + u64 partition_id;
Why drop the 'self' comment?
> + u64 device_id;
> + struct hv_interrupt_entry int_entry;
> + u64 reserved2;
> + struct hv_device_interrupt_target int_target;
> +} __packed __aligned(8);
> #endif
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index aacfcc90d929..0d9b74503577 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -406,36 +406,6 @@ struct pci_eject_response {
>
> static int pci_ring_size = (4 * PAGE_SIZE);
>
> -struct hv_interrupt_entry {
> - u32 source; /* 1 for MSI(-X) */
> - u32 reserved1;
> - u32 address;
> - u32 data;
> -};
> -
> -/*
> - * flags for hv_device_interrupt_target.flags
> - */
> -#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
> -#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
> -
> -struct hv_device_interrupt_target {
> - u32 vector;
> - u32 flags;
> - union {
> - u64 vp_mask;
> - struct hv_vpset vp_set;
> - };
> -};
> -
> -struct retarget_msi_interrupt {
> - u64 partition_id; /* use "self" */
> - u64 device_id;
> - struct hv_interrupt_entry int_entry;
> - u64 reserved2;
> - struct hv_device_interrupt_target int_target;
> -} __packed __aligned(8);
> -
> /*
> * Driver specific state.
> */
> @@ -482,7 +452,7 @@ struct hv_pcibus_device {
> struct workqueue_struct *wq;
>
> /* hypercall arg, must not cross page boundary */
> - struct retarget_msi_interrupt retarget_msi_interrupt_params;
> + struct hv_retarget_device_interrupt retarget_msi_interrupt_params;
>
> /*
> * Don't put anything here: retarget_msi_interrupt_params must be last
> @@ -1178,7 +1148,7 @@ static void hv_irq_unmask(struct irq_data *data)
> {
> struct msi_desc *msi_desc = irq_data_get_msi_desc(data);
> struct irq_cfg *cfg = irqd_cfg(data);
> - struct retarget_msi_interrupt *params;
> + struct hv_retarget_device_interrupt *params;
pci-hyperv.c also makes use of retarget_msi_interrupt_lock - it's really clear
from this name what it protects, however your rename now makes this more
confusing.
Likewise there is a comment in hv_pci_probe that refers to
retarget_msi_interrupt_params which is now stale.
It may be helpful to rename hv_retarget_device_interrupt for consistency with
the docs - however please make sure you catch all the references - I'd suggest
that the move and the rename are in different patches.
Thanks,
Andrew Murray
> struct hv_pcibus_device *hbus;
> struct cpumask *dest;
> cpumask_var_t tmp;
> --
> 2.24.1
>
^ permalink raw reply
* Re: [PATCH v2 1/3] PCI: hv: Move hypercall related definitions into tlfs header
From: Andrew Murray @ 2020-02-03 9:25 UTC (permalink / raw)
To: Boqun Feng
Cc: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel,
Sasha Levin, Lorenzo Pieralisi, Stephen Hemminger, Haiyang Zhang,
x86, Michael Kelley, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
Bjorn Helgaas, Andrew Murray, Thomas Gleixner, K. Y. Srinivasan
In-Reply-To: <20200203050313.69247-2-boqun.feng@gmail.com>
On Mon, Feb 03, 2020 at 01:03:11PM +0800, Boqun Feng wrote:
> Currently HVCALL_RETARGET_INTERRUPT and HV_PARTITION_ID_SELF are defined
> in pci-hyperv.c. However, similar to other hypercall related definitions
> , it makes more sense to put them in the tlfs header file.
Nit: please keep the comma attached to the previous word - even if that
means you need to move the word with it to the next line to maintain line
limits.
>
> Besides, these definitions are arch-dependent, so for the support of
> virtual PCI on non-x86 archs in the future, move them into arch-specific
> tlfs header file.
>
> Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
> ---
> arch/x86/include/asm/hyperv-tlfs.h | 3 +++
> drivers/pci/controller/pci-hyperv.c | 6 ------
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
> index 5f10f7f2098d..739bd89226a5 100644
> --- a/arch/x86/include/asm/hyperv-tlfs.h
> +++ b/arch/x86/include/asm/hyperv-tlfs.h
> @@ -376,6 +376,7 @@ struct hv_tsc_emulation_status {
> #define HVCALL_SEND_IPI_EX 0x0015
> #define HVCALL_POST_MESSAGE 0x005c
> #define HVCALL_SIGNAL_EVENT 0x005d
> +#define HVCALL_RETARGET_INTERRUPT 0x007e
> #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
> #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
>
> @@ -405,6 +406,8 @@ enum HV_GENERIC_SET_FORMAT {
> HV_GENERIC_SET_ALL,
> };
>
> +#define HV_PARTITION_ID_SELF ((u64)-1)
> +
> #define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0)
> #define HV_HYPERCALL_FAST_BIT BIT(16)
> #define HV_HYPERCALL_VARHEAD_OFFSET 17
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 9977abff92fc..aacfcc90d929 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -406,12 +406,6 @@ struct pci_eject_response {
>
> static int pci_ring_size = (4 * PAGE_SIZE);
>
> -/*
> - * Definitions or interrupt steering hypercall.
> - */
> -#define HV_PARTITION_ID_SELF ((u64)-1)
> -#define HVCALL_RETARGET_INTERRUPT 0x7e
> -
Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>
> struct hv_interrupt_entry {
> u32 source; /* 1 for MSI(-X) */
> u32 reserved1;
> --
> 2.24.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v2 2/3] PCI: hv: Move retarget related structures into tlfs header
From: Boqun Feng @ 2020-02-03 5:03 UTC (permalink / raw)
To: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel
Cc: Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas, Boqun Feng
In-Reply-To: <20200203050313.69247-1-boqun.feng@gmail.com>
Currently, retarget_msi_interrupt and other structures it relys on are
defined in pci-hyperv.c. However, those structures are actually defined
in Hypervisor Top-Level Functional Specification [1] and may be
different in sizes of fields or layout from architecture to
architecture. Therefore, this patch moves those definitions into x86's
tlfs header file to support virtual PCI on non-x86 architectures in the
future.
Besides, while I'm at it, rename retarget_msi_interrupt to
hv_retarget_msi_interrupt for the consistent name convention, also
mirroring the name in TLFS.
[1]: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
---
arch/x86/include/asm/hyperv-tlfs.h | 31 ++++++++++++++++++++++++++
drivers/pci/controller/pci-hyperv.c | 34 ++---------------------------
2 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
index 739bd89226a5..4a76e442481a 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -911,4 +911,35 @@ struct hv_tlb_flush_ex {
struct hv_partition_assist_pg {
u32 tlb_lock_count;
};
+
+struct hv_interrupt_entry {
+ u32 source; /* 1 for MSI(-X) */
+ u32 reserved1;
+ u32 address;
+ u32 data;
+} __packed;
+
+/*
+ * flags for hv_device_interrupt_target.flags
+ */
+#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
+#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
+
+struct hv_device_interrupt_target {
+ u32 vector;
+ u32 flags;
+ union {
+ u64 vp_mask;
+ struct hv_vpset vp_set;
+ };
+} __packed;
+
+/* HvRetargetDeviceInterrupt hypercall */
+struct hv_retarget_device_interrupt {
+ u64 partition_id;
+ u64 device_id;
+ struct hv_interrupt_entry int_entry;
+ u64 reserved2;
+ struct hv_device_interrupt_target int_target;
+} __packed __aligned(8);
#endif
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index aacfcc90d929..0d9b74503577 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -406,36 +406,6 @@ struct pci_eject_response {
static int pci_ring_size = (4 * PAGE_SIZE);
-struct hv_interrupt_entry {
- u32 source; /* 1 for MSI(-X) */
- u32 reserved1;
- u32 address;
- u32 data;
-};
-
-/*
- * flags for hv_device_interrupt_target.flags
- */
-#define HV_DEVICE_INTERRUPT_TARGET_MULTICAST 1
-#define HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET 2
-
-struct hv_device_interrupt_target {
- u32 vector;
- u32 flags;
- union {
- u64 vp_mask;
- struct hv_vpset vp_set;
- };
-};
-
-struct retarget_msi_interrupt {
- u64 partition_id; /* use "self" */
- u64 device_id;
- struct hv_interrupt_entry int_entry;
- u64 reserved2;
- struct hv_device_interrupt_target int_target;
-} __packed __aligned(8);
-
/*
* Driver specific state.
*/
@@ -482,7 +452,7 @@ struct hv_pcibus_device {
struct workqueue_struct *wq;
/* hypercall arg, must not cross page boundary */
- struct retarget_msi_interrupt retarget_msi_interrupt_params;
+ struct hv_retarget_device_interrupt retarget_msi_interrupt_params;
/*
* Don't put anything here: retarget_msi_interrupt_params must be last
@@ -1178,7 +1148,7 @@ static void hv_irq_unmask(struct irq_data *data)
{
struct msi_desc *msi_desc = irq_data_get_msi_desc(data);
struct irq_cfg *cfg = irqd_cfg(data);
- struct retarget_msi_interrupt *params;
+ struct hv_retarget_device_interrupt *params;
struct hv_pcibus_device *hbus;
struct cpumask *dest;
cpumask_var_t tmp;
--
2.24.1
^ permalink raw reply related
* [PATCH v2 1/3] PCI: hv: Move hypercall related definitions into tlfs header
From: Boqun Feng @ 2020-02-03 5:03 UTC (permalink / raw)
To: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel
Cc: Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas, Boqun Feng
In-Reply-To: <20200203050313.69247-1-boqun.feng@gmail.com>
Currently HVCALL_RETARGET_INTERRUPT and HV_PARTITION_ID_SELF are defined
in pci-hyperv.c. However, similar to other hypercall related definitions
, it makes more sense to put them in the tlfs header file.
Besides, these definitions are arch-dependent, so for the support of
virtual PCI on non-x86 archs in the future, move them into arch-specific
tlfs header file.
Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
---
arch/x86/include/asm/hyperv-tlfs.h | 3 +++
drivers/pci/controller/pci-hyperv.c | 6 ------
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
index 5f10f7f2098d..739bd89226a5 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -376,6 +376,7 @@ struct hv_tsc_emulation_status {
#define HVCALL_SEND_IPI_EX 0x0015
#define HVCALL_POST_MESSAGE 0x005c
#define HVCALL_SIGNAL_EVENT 0x005d
+#define HVCALL_RETARGET_INTERRUPT 0x007e
#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
@@ -405,6 +406,8 @@ enum HV_GENERIC_SET_FORMAT {
HV_GENERIC_SET_ALL,
};
+#define HV_PARTITION_ID_SELF ((u64)-1)
+
#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0)
#define HV_HYPERCALL_FAST_BIT BIT(16)
#define HV_HYPERCALL_VARHEAD_OFFSET 17
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 9977abff92fc..aacfcc90d929 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -406,12 +406,6 @@ struct pci_eject_response {
static int pci_ring_size = (4 * PAGE_SIZE);
-/*
- * Definitions or interrupt steering hypercall.
- */
-#define HV_PARTITION_ID_SELF ((u64)-1)
-#define HVCALL_RETARGET_INTERRUPT 0x7e
-
struct hv_interrupt_entry {
u32 source; /* 1 for MSI(-X) */
u32 reserved1;
--
2.24.1
^ permalink raw reply related
* [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry
From: Boqun Feng @ 2020-02-03 5:03 UTC (permalink / raw)
To: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel
Cc: Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas, Boqun Feng
In-Reply-To: <20200203050313.69247-1-boqun.feng@gmail.com>
Add a new structure (hv_msi_entry), which is also defined int tlfs, to
describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is
needed because its layout may be different from architecture to
architecture.
Also add a new generic interface hv_set_msi_address_from_desc() to allow
different archs to set the msi address from msi_desc.
No functional change, only preparation for the future support of virtual
PCI on non-x86 architectures.
Signed-off-by: Boqun Feng (Microsoft) <boqun.feng@gmail.com>
---
arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++--
arch/x86/include/asm/mshyperv.h | 5 +++++
drivers/pci/controller/pci-hyperv.c | 4 ++--
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h
index 4a76e442481a..953b3ad38746 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -912,11 +912,18 @@ struct hv_partition_assist_pg {
u32 tlb_lock_count;
};
+union hv_msi_entry {
+ u64 as_uint64;
+ struct {
+ u32 address;
+ u32 data;
+ } __packed;
+};
+
struct hv_interrupt_entry {
u32 source; /* 1 for MSI(-X) */
u32 reserved1;
- u32 address;
- u32 data;
+ union hv_msi_entry msi_entry;
} __packed;
/*
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 6b79515abb82..3bdaa3b6e68f 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu);
static inline void hv_apic_init(void) {}
#endif
+#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \
+do { \
+ (msi_entry)->address = (msi_desc)->msg.address_lo; \
+} while (0)
+
#else /* CONFIG_HYPERV */
static inline void hyperv_init(void) {}
static inline void hyperv_setup_mmu_ops(void) {}
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 0d9b74503577..2240f2b3643e 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data)
memset(params, 0, sizeof(*params));
params->partition_id = HV_PARTITION_ID_SELF;
params->int_entry.source = 1; /* MSI(-X) */
- params->int_entry.address = msi_desc->msg.address_lo;
- params->int_entry.data = msi_desc->msg.data;
+ hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc);
+ params->int_entry.msi_entry.data = msi_desc->msg.data;
params->device_id = (hbus->hdev->dev_instance.b[5] << 24) |
(hbus->hdev->dev_instance.b[4] << 16) |
(hbus->hdev->dev_instance.b[7] << 8) |
--
2.24.1
^ permalink raw reply related
* [PATCH v2 0/3] PCI: hv: Generify pci-hyperv.c
From: Boqun Feng @ 2020-02-03 5:03 UTC (permalink / raw)
To: linux-pci, linux-hyperv, linux-kernel, linux-arm-kernel
Cc: Michael Kelley, K. Y. Srinivasan, Haiyang Zhang,
Stephen Hemminger, Sasha Levin, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, Lorenzo Pieralisi,
Andrew Murray, Bjorn Helgaas, Boqun Feng
Hi,
This is the first part for virtual PCI support of Hyper-V guest on
ARM64. The whole patchset doesn't have any functional change, but only
refactors the pci-hyperv.c code to make it more arch-independent.
Previous version:
v1: https://lore.kernel.org/lkml/20200121015713.69691-1-boqun.feng@gmail.com/
Changes since v1:
* Reword the commit log and adjust the title as per Bjorn's
suggestion
* Split patch #2 into two patches (one for moving and one for
adding new structure) as per Bjorn's suggestion
* Remove unnecesarry #if guard as per Vitaly's suggestion.
* Add explanation for adding hv_set_msi_address_from_desc().
I've done compile and boot test of this patchset, also done some tests
with a pass-through NVMe device.
Suggestions and comments are welcome!
Regards,
Boqun
Boqun Feng (3):
PCI: hv: Move hypercall related definitions into tlfs header
PCI: hv: Move retarget related structures into tlfs header
PCI: hv: Introduce hv_msi_entry
arch/x86/include/asm/hyperv-tlfs.h | 41 +++++++++++++++++++++++++++
arch/x86/include/asm/mshyperv.h | 5 ++++
drivers/pci/controller/pci-hyperv.c | 44 +++--------------------------
3 files changed, 50 insertions(+), 40 deletions(-)
--
2.24.1
^ permalink raw reply
* [GIT PULL] Hyper-V commits for v5.6
From: Sasha Levin @ 2020-02-03 2:27 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-hyperv, kys, sthemmin, linux-kernel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
The following changes since commit fd6988496e79a6a4bdb514a4655d2920209eb85d:
Linux 5.5-rc4 (2019-12-29 15:29:16 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git tags/hyperv-next-signed
for you to fetch changes up to 54e19d34011fea26d39aa74781131de0ce642a01:
hv_utils: Add the support of hibernation (2020-01-26 22:10:17 -0500)
- ----------------------------------------------------------------
- - Most of the commits here are work to enable host-initiated hibernation
support by Dexuan Cui.
- - Fix for a warning shown when host sends non-aligned balloon requests
by Tianyu Lan.
- ----------------------------------------------------------------
Dexuan Cui (7):
Input: hyperv-keyboard: Add the support of hibernation
video: hyperv_fb: Fix hibernation for the deferred IO feature
Drivers: hv: vmbus: Ignore CHANNELMSG_TL_CONNECT_RESULT(23)
Tools: hv: Reopen the devices if read() or write() returns errors
hv_utils: Support host-initiated restart request
hv_utils: Support host-initiated hibernation request
hv_utils: Add the support of hibernation
Tianyu Lan (1):
hv_balloon: Balloon up according to request page number
Wei Hu (1):
video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.
drivers/hv/channel_mgmt.c | 21 ++--
drivers/hv/hv_balloon.c | 13 +--
drivers/hv/hv_fcopy.c | 54 +++++++++-
drivers/hv/hv_kvp.c | 43 +++++++-
drivers/hv/hv_snapshot.c | 55 +++++++++-
drivers/hv/hv_util.c | 148 +++++++++++++++++++++++++--
drivers/hv/hyperv_vmbus.h | 6 ++
drivers/hv/vmbus_drv.c | 4 +
drivers/input/serio/hyperv-keyboard.c | 27 +++++
drivers/video/fbdev/Kconfig | 1 +
drivers/video/fbdev/hyperv_fb.c | 184 +++++++++++++++++++++++++++-------
include/linux/hyperv.h | 4 +
tools/hv/hv_fcopy_daemon.c | 37 ++++++-
tools/hv/hv_kvp_daemon.c | 36 ++++---
tools/hv/hv_vss_daemon.c | 49 +++++++--
15 files changed, 574 insertions(+), 108 deletions(-)
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEE4n5dijQDou9mhzu83qZv95d3LNwFAl43hNkACgkQ3qZv95d3
LNzSMA/7BCxCW9lMFzTCtL2bhAw48CFxFTpCvj5oM39kCLaxT99l/ub5BydOi8+2
URGnnWL+6wQSVpnCLjm6BBhbj8CX2jSoG7PgrsT5E1/wpMQafP8vVzi5HmBh2VJL
usL3ZrvbeHsRlHPr06l9QGe+CMr+eovfd51/v2/aiQEvzl/ekRBqctYH30boXRR3
CuknWJaS4MRuw5IdnSW6l1wfWn1uzpG5qRD7uHDvK0fkRRKq9Bd7gOOj525qrhYP
raLwziF3y6cAwco5YPgPWoQvPoT1Kx04CYi5+HH5na4OVXGxI0wNAJDiwuj9h94n
rfA0FfoBYU0vwT4cp++fIjp3wC2INe1rbrOapy6oFoVn/8wIUe7re23nAO04Vr+g
sRqDO1qkDQaqWHw27GbtiXtrb8Y5nHpvv6/dAWCNFQnXipeWHzRlF+ppgTi3aQLE
cl/GhqUVa10owOP06JiEB3ArPDh4UVetjOYAmF8LYkmEgo3nXK/Fptoi/BEUN5tY
L8iIdvSz5pkuZTM0pXyLjRfBozZCtHj4vx39Q6eyMkFqD1hPQi8zq1PqfdyMmucq
I33D515yl0qIVB/Qu/I+93ne2sdPQlC889lEDm8CwLbKoSDATYam64mPSd0gDuBU
YiNvjqSIfqa/uxPTk40C5Y/YdBgmOFKbM7Sx1XI8YVYvcRVZ9LM=
=tt50
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [PATCH v6][RESEND] x86/hyperv: Suspend/resume the hypercall page for hibernation
From: Thomas Gleixner @ 2020-01-30 7:37 UTC (permalink / raw)
To: Sasha Levin, Dexuan Cui
Cc: arnd@arndb.de, bp@alien8.de, daniel.lezcano@linaro.org,
Haiyang Zhang, hpa@zytor.com, KY Srinivasan,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, Stephen Hemminger, x86@kernel.org,
Michael Kelley, Sasha Levin, vkuznets, linux-arch@vger.kernel.org
In-Reply-To: <20200130000552.GD2896@sasha-vm>
Sasha Levin <sashal@kernel.org> writes:
> On Sat, Jan 25, 2020 at 01:44:31AM +0000, Dexuan Cui wrote:
>>> This is a RESEND of https://lkml.org/lkml/2019/11/20/68
>>>
>>> Please review.
>>>
>>> If it looks good, can you please pick it up through the tip.git tree?
>>>
>>> arch/x86/hyperv/hv_init.c | 48
>>> +++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 48 insertions(+)
>>
>>Hi, Vitaly and x86 maintainers,
>>Can you please take a look at this patch?
>
> Ping?
>
> This patch has been floating around in it's current form for the past 2
> months. I'll happily take Hyper-V patches under arch/x86/hyperv/ via the
> Hyper-V tree rather than tip if the x86 folks don't want to deal with
> them.
sorry fell through the cracks. Will take care of it.
^ permalink raw reply
* RE: [PATCH v6][RESEND] x86/hyperv: Suspend/resume the hypercall page for hibernation
From: Dexuan Cui @ 2020-01-30 1:02 UTC (permalink / raw)
To: Sasha Levin, tglx@linutronix.de
Cc: arnd@arndb.de, bp@alien8.de, daniel.lezcano@linaro.org,
Haiyang Zhang, hpa@zytor.com, KY Srinivasan,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, Stephen Hemminger, x86@kernel.org,
Michael Kelley, Sasha Levin, vkuznets, linux-arch@vger.kernel.org
In-Reply-To: <20200130000552.GD2896@sasha-vm>
> From: linux-hyperv-owner@vger.kernel.org
> <linux-hyperv-owner@vger.kernel.org> On Behalf Of Sasha Levin
> Sent: Wednesday, January 29, 2020 4:06 PM
> To: Dexuan Cui <decui@microsoft.com>
> Cc: arnd@arndb.de; bp@alien8.de; daniel.lezcano@linaro.org; Haiyang Zhang
> <haiyangz@microsoft.com>; hpa@zytor.com; KY Srinivasan
> <kys@microsoft.com>; linux-hyperv@vger.kernel.org;
> linux-kernel@vger.kernel.org; mingo@redhat.com; Stephen Hemminger
> <sthemmin@microsoft.com>; tglx@linutronix.de; x86@kernel.org; Michael
> Kelley <mikelley@microsoft.com>; Sasha Levin
> <Alexander.Levin@microsoft.com>; vkuznets <vkuznets@redhat.com>;
> linux-arch@vger.kernel.org
> Subject: Re: [PATCH v6][RESEND] x86/hyperv: Suspend/resume the hypercall
> page for hibernation
>
> On Sat, Jan 25, 2020 at 01:44:31AM +0000, Dexuan Cui wrote:
> >> From: Dexuan Cui <decui@microsoft.com>
> >> Sent: Monday, January 6, 2020 2:43 PM
> >>
> >> This is needed for hibernation, e.g. when we resume the old kernel, we
> need
> >> to disable the "current" kernel's hypercall page and then resume the old
> >> kernel's.
> >>
> >> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> >> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
> >> ---
> >>
> >> This is a RESEND of https://lkml.org/lkml/2019/11/20/68
> >>
> >> Please review.
> >>
> >> If it looks good, can you please pick it up through the tip.git tree?
> >>
> >> arch/x86/hyperv/hv_init.c | 48
> >> +++++++++++++++++++++++++++++++++++++++
> >> 1 file changed, 48 insertions(+)
> >
> >Hi, Vitaly and x86 maintainers,
> >Can you please take a look at this patch?
>
> Ping?
>
> This patch has been floating around in it's current form for the past 2
> months. I'll happily take Hyper-V patches under arch/x86/hyperv/ via the
> Hyper-V tree rather than tip if the x86 folks don't want to deal with
> them.
>
> --
> Thanks,
> Sasha
This straightforward patch is the only pending patch for v5.6 for the
hibernation functionality of Linux VM on Hyper-V. It would be really great
if we could merge it for v5.6-rc1. The patch is safe in that it only runs when
the VM hibernates, and the hibernation functionality of Linux VM on
Hyper-V never worked before. I'm pretty sure the patch can not cause any
merge conflict since nobody else tries to modify the file recently.
Thanks,
-- Dexuan
^ permalink raw reply
* Re: [PATCH v6][RESEND] x86/hyperv: Suspend/resume the hypercall page for hibernation
From: Sasha Levin @ 2020-01-30 0:05 UTC (permalink / raw)
To: Dexuan Cui
Cc: arnd@arndb.de, bp@alien8.de, daniel.lezcano@linaro.org,
Haiyang Zhang, hpa@zytor.com, KY Srinivasan,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@redhat.com, Stephen Hemminger, tglx@linutronix.de,
x86@kernel.org, Michael Kelley, Sasha Levin, vkuznets,
linux-arch@vger.kernel.org
In-Reply-To: <HK0P153MB0148ED41CE96B637019DF26ABF090@HK0P153MB0148.APCP153.PROD.OUTLOOK.COM>
On Sat, Jan 25, 2020 at 01:44:31AM +0000, Dexuan Cui wrote:
>> From: Dexuan Cui <decui@microsoft.com>
>> Sent: Monday, January 6, 2020 2:43 PM
>>
>> This is needed for hibernation, e.g. when we resume the old kernel, we need
>> to disable the "current" kernel's hypercall page and then resume the old
>> kernel's.
>>
>> Signed-off-by: Dexuan Cui <decui@microsoft.com>
>> Reviewed-by: Michael Kelley <mikelley@microsoft.com>
>> ---
>>
>> This is a RESEND of https://lkml.org/lkml/2019/11/20/68
>>
>> Please review.
>>
>> If it looks good, can you please pick it up through the tip.git tree?
>>
>> arch/x86/hyperv/hv_init.c | 48
>> +++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 48 insertions(+)
>
>Hi, Vitaly and x86 maintainers,
>Can you please take a look at this patch?
Ping?
This patch has been floating around in it's current form for the past 2
months. I'll happily take Hyper-V patches under arch/x86/hyperv/ via the
Hyper-V tree rather than tip if the x86 folks don't want to deal with
them.
--
Thanks,
Sasha
^ permalink raw reply
* Re: [RFC 0/6] vDSO support for Hyper-V guest on ARM64
From: Marc Zyngier @ 2020-01-28 11:48 UTC (permalink / raw)
To: Boqun Feng
Cc: Vincenzo Frascino, Sasha Levin, linux-hyperv, Stefano Stabellini,
Stephen Hemminger, Catalin Marinas, Haiyang Zhang, linux-kernel,
Michael Kelley, xen-devel, Thomas Gleixner, K. Y. Srinivasan,
Will Deacon, linux-arm-kernel
In-Reply-To: <20200128055846.GA83200@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net>
On 2020-01-28 05:58, Boqun Feng wrote:
> On Fri, Jan 24, 2020 at 10:24:44AM +0000, Vincenzo Frascino wrote:
>> Hi Boqun Feng,
>>
>> On 24/01/2020 06:32, Boqun Feng wrote:
>> > Hi Vincenzo,
>> >
>>
>> [...]
>>
>> >>
>> >> I had a look to your patches and overall, I could not understand why we can't
>> >> use the arch_timer to do the same things you are doing with the one you
>> >> introduced in this series. What confuses me is that KVM works just fine with the
>> >> arch_timer which was designed with virtualization in mind. Why do we need
>> >> another one? Could you please explain?
>> >>
>> >
>> > Please note that the guest VM on Hyper-V for ARM64 doesn't use
>> > arch_timer as the clocksource. See:
>> >
>> > https://lore.kernel.org/linux-arm-kernel/1570129355-16005-7-git-send-email-mikelley@microsoft.com/
>> >
>> > , ACPI_SIG_GTDT is used for setting up Hyper-V synthetic clocksource
>> > and other initialization work.
>> >
>>
>> I had a look a look at it and my question stands, why do we need
>> another timer
>> on arm64?
>>
>
> Sorry for the late response. It's weekend and Chinese New Year, so I
> got
> to spend some time making (and mostly eating) dumplings ;-)
And you haven't been sharing! ;-)
> After discussion with Michael, here is some explanation why we need
> another timer:
>
> The synthetic clocks that Hyper-V presents in a guest VM were
> originally
> created for the x86 architecture. They provide a level of abstraction
> that solves problems like continuity across live migrations where the
> hardware clock (i.e., TSC in the case x86) frequency may be different
> across the migration. When Hyper-V was brought to ARM64, this
> abstraction was maintained to provide consistency across the x86 and
> ARM64 architectures, and for both Windows and Linux guest VMs. The
> core Linux code for the Hyper-V clocks (in
> drivers/clocksource/hyperv_timer.c) is architecture neutral and works
> on
> both x86 and ARM64. As you can see, this part is done in Michael's
> patchset.
>
> Arguably, Hyper-V for ARM64 should have optimized for consistency with
> the ARM64 community rather with the existing x86 implementation and
> existing guest code in Windows. But at this point, it is what it is,
> and the Hyper-V clocks do solve problems like migration that aren’t
> addressed in ARM64 until v8.4 of the architecture with the addition of
> the counter hardware scaling feature. Hyper-V doesn’t currently map the
> ARM arch timer interrupts into guest VMs, so we need to use the
> existing
> Hyper-V clocks and the common code that already exists.
The migration thing is a bit of a red herring. Do you really anticipate
VM migration across systems that have their timers running at different
frequencies *today*? And even if you did, there are ways to deal with it
with the arch timers (patches to that effect were posted on the list,
and
there was even a bit of an ARM spec for it).
I find it odd to try and make arm64 "just another x86", while the
architecture
gives you most of what you need already. I guess I'm tainted.
Thanks,
M.
--
Who you jivin' with that Cosmik Debris?
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox