Re: [PATCH 01/28] x86/hyperv: use vmalloc_exec for the hypercall page

2020-04-09 Thread Wei Liu
On Wed, Apr 08, 2020 at 01:58:59PM +0200, Christoph Hellwig wrote: > Use the designated helper for allocating executable kernel memory, and > remove the now unused PAGE_KERNEL_RX define. > > Signed-off-by: Christoph Hellwig Acked

Re: [PATCH 21/29] mm: remove the pgprot argument to __vmalloc

2020-04-14 Thread Wei Liu
*hvp = __vmalloc(PAGE_SIZE, GFP_KERNEL | __GFP_ZERO); > } Acked-by: Wei Liu ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [patch V2 14/46] x86/ioapic: Consolidate IOAPIC allocation

2020-09-08 Thread Wei Liu
perv_ir_set_ >* affinity() set vector and dest_apicid directly into IO-APIC entry. >*/ > - irq_data->chip_data = info->ioapic_entry; > + irq_data->chip_data = info->ioapic.entry; Not sure if it is required for such a trivial change

Re: [patch V2 18/46] x86/msi: Consolidate MSI allocation

2020-09-08 Thread Wei Liu
hwirq(struct msi_domain_info > *info, > msi_alloc_info_t *arg) > { > - return arg->msi_hwirq; > + return arg->hwirq; > } Acked-by: Wei Liu ___ iommu mailing list io

[PATCH RFC v1 04/18] iommu/hyperv: don't setup IRQ remapping when running as root

2020-09-14 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root. Signed-off-by: Wei Liu --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/hyperv-iommu.c b/drivers/iommu/hyperv

Re: [PATCH 1/2] iommu/hyper-v: Constify hyperv_ir_domain_ops

2020-05-26 Thread Wei Liu
2052161460 drivers/iommu/hyperv-iommu.o > > After: >textdata bss dec hex filename >30441052112052161460 drivers/iommu/hyperv-iommu.o > > Signed-off-by: Rikard Falkeborn Acked-by: Wei Liu > --- > drivers/iommu/hyperv-iom

[PATCH v4 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2021-01-06 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Joerg Roedel Reviewed-by: Vitaly Kuznetsov --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

[PATCH v3 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-24 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Joerg Roedel Reviewed-by: Vitaly Kuznetsov --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

Re: [PATCH v2 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-13 Thread Wei Liu
On Thu, Nov 12, 2020 at 04:27:14PM +0100, Vitaly Kuznetsov wrote: > Wei Liu writes: > > > The IOMMU code needs more work. We're sure for now the IRQ remapping > > hooks are not applicable when Linux is the root. > > Super-nitpick: I would suggest we always say 'root pa

[PATCH v2 04/17] iommu/hyperv: don't setup IRQ remapping when running as root

2020-11-05 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root. Signed-off-by: Wei Liu Acked-by: Joerg Roedel --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/hyperv

[PATCH v5 16/16] iommu/hyperv: setup an IO-APIC IRQ remapping domain for root partition

2021-01-20 Thread Wei Liu
Just like MSI/MSI-X, IO-APIC interrupts are remapped by Microsoft Hypervisor when Linux runs as the root partition. Implement an IRQ domain to handle mapping and unmapping of IO-APIC interrupts. Signed-off-by: Wei Liu --- arch/x86/hyperv/irqdomain.c | 54 ++ arch/x86/include/asm

[PATCH v5 04/16] iommu/hyperv: don't setup IRQ remapping when running as root

2021-01-20 Thread Wei Liu
The IOMMU code needs more work. We're sure for now the IRQ remapping hooks are not applicable when Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Joerg Roedel Reviewed-by: Vitaly Kuznetsov --- drivers/iommu/hyperv-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion

Re: [PATCH v5 16/16] iommu/hyperv: setup an IO-APIC IRQ remapping domain for root partition

2021-02-03 Thread Wei Liu
On Wed, Jan 27, 2021 at 05:47:08AM +, Michael Kelley wrote: > From: Wei Liu Sent: Wednesday, January 20, 2021 4:01 AM > > > > Just like MSI/MSI-X, IO-APIC interrupts are remapped by Microsoft > > Hypervisor when Linux runs as the root partition. Implement an IRQ > &g

[PATCH v6 16/16] iommu/hyperv: setup an IO-APIC IRQ remapping domain for root partition

2021-02-03 Thread Wei Liu
Just like MSI/MSI-X, IO-APIC interrupts are remapped by Microsoft Hypervisor when Linux runs as the root partition. Implement an IRQ domain to handle mapping and unmapping of IO-APIC interrupts. Signed-off-by: Wei Liu --- v6: 1. Simplify code due to changes in a previous patch. --- arch/x86

[RFC v1 3/8] intel/vt-d: make DMAR table parsing code more flexible

2021-07-09 Thread Wei Liu
. Signed-off-by: Wei Liu --- We may be able to combine alloc and force_parse? --- drivers/iommu/intel/dmar.c | 38 - drivers/iommu/intel/iommu.c | 2 +- drivers/iommu/intel/irq_remapping.c | 2 +- include/linux/dmar.h| 2 +- 4 files

[RFC v1 6/8] mshv: command line option to skip devices in PV-IOMMU

2021-07-09 Thread Wei Liu
a command line option for skipping devices. This is a stopgap solution, so it is intentionally undocumented. Hopefully we can retire it in the future. Signed-off-by: Wei Liu --- drivers/iommu/hyperv-iommu.c | 45 1 file changed, 45 insertions(+) diff --git

[RFC v1 4/8] intel/vt-d: export intel_iommu_get_resv_regions

2021-07-09 Thread Wei Liu
When Microsoft Hypervisor runs on Intel platforms it needs to know the reserved regions to program devices correctly. There is no reason to duplicate intel_iommu_get_resv_regions. Export it. Signed-off-by: Wei Liu --- drivers/iommu/intel/iommu.c | 5 +++-- include/linux/intel-iommu.h | 4

[RFC v1 5/8] mshv: add paravirtualized IOMMU support

2021-07-09 Thread Wei Liu
Microsoft Hypervisor provides a set of hypercalls to manage device domains. Implement a type-1 IOMMU using those hypercalls. Implement DMA remapping as the first step for this driver. Interrupt remapping will come in a later stage. Signed-off-by: Wei Liu --- drivers/iommu/Kconfig| 14

Re: [RFC v1 4/8] intel/vt-d: export intel_iommu_get_resv_regions

2021-07-09 Thread Wei Liu
On Fri, Jul 09, 2021 at 10:17:25PM +0800, Lu Baolu wrote: > On 2021/7/9 19:43, Wei Liu wrote: > > When Microsoft Hypervisor runs on Intel platforms it needs to know the > > reserved regions to program devices correctly. There is no reason to > > duplicate intel_iommu_get

Re: [RFC v1 3/8] intel/vt-d: make DMAR table parsing code more flexible

2021-07-09 Thread Wei Liu
On Fri, Jul 09, 2021 at 01:56:46PM +0100, Robin Murphy wrote: > On 2021-07-09 12:43, Wei Liu wrote: > > Microsoft Hypervisor provides a set of hypercalls to manage device > > domains. The root kernel should parse the DMAR so that it can program > > the IOMMU (with

Re: [RFC v1 6/8] mshv: command line option to skip devices in PV-IOMMU

2021-07-09 Thread Wei Liu
On Fri, Jul 09, 2021 at 01:46:19PM +0100, Robin Murphy wrote: > On 2021-07-09 12:43, Wei Liu wrote: > > Some devices may have been claimed by the hypervisor already. One such > > example is a user can assign a NIC for debugging purpose. > > > > Ideally Linux shou

Re: [PATCH v5 16/16] iommu/hyperv: setup an IO-APIC IRQ remapping domain for root partition

2021-02-04 Thread Wei Liu
On Thu, Feb 04, 2021 at 04:41:47PM +, Michael Kelley wrote: > From: Wei Liu Sent: Wednesday, February 3, 2021 4:47 AM [...] > > > > + > > > > + if (level) > > > > + intr_desc->trigger_mode = > > > >

Re: [RFC v1 6/8] mshv: command line option to skip devices in PV-IOMMU

2021-08-10 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:33:54PM +0530, Praveen Kumar wrote: > On 04-08-2021 03:26, Wei Liu wrote: > >>> struct iommu_domain domain; > >>> @@ -774,6 +784,41 @@ static struct iommu_device > >>> *hv_iommu_probe_device(struct device *dev) > >>

Re: [RFC v1 5/8] mshv: add paravirtualized IOMMU support

2021-08-10 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:13:42PM +0530, Praveen Kumar wrote: > On 04-08-2021 03:17, Wei Liu wrote: > >>> +static size_t hv_iommu_unmap(struct iommu_domain *d, unsigned long iova, > >>> +size_t size, struct iommu_iotlb_gather *gather) >

Re: [PATCH V3 01/13] x86/HV: Initialize GHCB page in Isolation VM

2021-08-10 Thread Wei Liu
On Mon, Aug 09, 2021 at 01:56:05PM -0400, Tianyu Lan wrote: [...] > static int hv_cpu_init(unsigned int cpu) > { > union hv_vp_assist_msr_contents msr = { 0 }; > @@ -85,6 +111,8 @@ static int hv_cpu_init(unsigned int cpu) > } > } > > + hyperv_init_ghcb(); > + Why

Re: [PATCH V3 03/13] x86/HV: Add new hvcall guest address host visibility support

2021-08-10 Thread Wei Liu
On Mon, Aug 09, 2021 at 01:56:07PM -0400, Tianyu Lan wrote: > From: Tianyu Lan > > Add new hvcall guest address host visibility support to mark > memory visible to host. Call it inside set_memory_decrypted > /encrypted(). Add HYPERVISOR feature check in the > hv_is_isolation_supported() to

Re: [RFC v1 5/8] mshv: add paravirtualized IOMMU support

2021-08-03 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:10:45AM +0530, Praveen Kumar wrote: > On 09-07-2021 17:13, Wei Liu wrote: > > +static void hv_iommu_domain_free(struct iommu_domain *d) > > +{ > > + struct hv_iommu_domain *domain = to_hv_iommu_domain(d); > > + unsigned long flags; > &g

Re: [RFC v1 6/8] mshv: command line option to skip devices in PV-IOMMU

2021-08-03 Thread Wei Liu
On Wed, Aug 04, 2021 at 12:20:42AM +0530, Praveen Kumar wrote: > On 09-07-2021 17:13, Wei Liu wrote: > > Some devices may have been claimed by the hypervisor already. One such > > example is a user can assign a NIC for debugging purpose. > > > > Ideally Linux shou

Re: [PATCH V7 0/5] x86/Hyper-V: Add Hyper-V Isolation VM support(Second part)

2021-12-17 Thread Wei Liu
On Mon, Dec 13, 2021 at 02:14:01AM -0500, Tianyu Lan wrote: > From: Tianyu Lan [...] > > Tianyu Lan (5): > swiotlb: Add swiotlb bounce buffer remap function for HV IVM > x86/hyper-v: Add hyperv Isolation VM check in the cc_platform_has() > hyper-v: Enable swiotlb bounce buffer for

Re: [PATCH] Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()

2022-01-02 Thread Wei Liu
On Fri, Dec 31, 2021 at 11:56:40AM -0500, Tianyu Lan wrote: > From: Tianyu Lan > > HAS_IOMEM option may not be selected on some platforms(e.g, s390) and this > will cause compile error due to miss memremap() implementation. Fix it via miss -> missingk > adding HAS_IOMEM check around memremap()

Re: [PATCH] Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()

2022-01-04 Thread Wei Liu
On Tue, Jan 04, 2022 at 04:03:07PM +0100, Christoph Hellwig wrote: > On Tue, Jan 04, 2022 at 02:51:55PM +0000, Wei Liu wrote: > > > Please stub out all of swiotlb_mem_remap instead of the ifdef inside the > > > function. > > > > Does this look okay to you? > &

Re: [PATCH V7 1/5] swiotlb: Add swiotlb bounce buffer remap function for HV IVM

2021-12-16 Thread Wei Liu
On Wed, Dec 15, 2021 at 01:00:38PM +0800, Tianyu Lan wrote: > > > On 12/15/2021 6:40 AM, Dave Hansen wrote: > > On 12/14/21 2:23 PM, Tom Lendacky wrote: > > > > I don't really understand how this can be more general any *not* get > > > > utilized by the existing SEV support. > > > > > > The

Re: [PATCH V7 2/5] x86/hyper-v: Add hyperv Isolation VM check in the cc_platform_has()

2021-12-14 Thread Wei Liu
On Mon, Dec 13, 2021 at 02:14:03AM -0500, Tianyu Lan wrote: > From: Tianyu Lan > > Hyper-V provides Isolation VM for confidential computing support and > guest memory is encrypted in it. Places checking cc_platform_has() > with GUEST_MEM_ENCRYPT attr should return "True" in Isolation vm. e.g, >

Re: [PATCH V3 2/5] x86/hyper-v: Add hyperv Isolation VM check in the cc_platform_has()

2021-12-02 Thread Wei Liu
On Wed, Dec 01, 2021 at 11:02:53AM -0500, Tianyu Lan wrote: > From: Tianyu Lan > > Hyper-V provides Isolation VM which has memory encrypt support. Add > hyperv_cc_platform_has() and return true for check of GUEST_MEM_ENCRYPT > attribute. > > Signed-off-by: Tianyu Lan > --- >

Re: [PATCH V3 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM

2021-12-02 Thread Wei Liu
On Wed, Dec 01, 2021 at 11:02:54AM -0500, Tianyu Lan wrote: [...] > diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c > index 46df59aeaa06..30fd0600b008 100644 > --- a/arch/x86/xen/pci-swiotlb-xen.c > +++ b/arch/x86/xen/pci-swiotlb-xen.c > @@ -4,6 +4,7 @@ > > #include

Re: [PATCH] Swiotlb: Add CONFIG_HAS_IOMEM check around memremap() in the swiotlb_mem_remap()

2022-01-04 Thread Wei Liu
On Sun, Jan 02, 2022 at 11:54:46PM -0800, Christoph Hellwig wrote: > On Fri, Dec 31, 2021 at 11:56:40AM -0500, Tianyu Lan wrote: > > From: Tianyu Lan > > > > HAS_IOMEM option may not be selected on some platforms(e.g, s390) and this > > will cause compile error due to miss memremap()

Re: [PATCH v3 0/2] Fix coherence for VMbus and PCI pass-thru devices in Hyper-V VM

2022-03-29 Thread Wei Liu
On Thu, Mar 24, 2022 at 09:14:50AM -0700, Michael Kelley wrote: > Hyper-V VMs have VMbus synthetic devices and PCI pass-thru devices that are > added > dynamically via the VMbus protocol and are not represented in the ACPI DSDT. > Only > the top level VMbus node exists in the DSDT. As such, on