Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-09-01 Thread Boqun Feng
Hi Thomas, On Wed, Aug 26, 2020 at 01:16:28PM +0200, Thomas Gleixner wrote: [...] > > The whole lot is also available from git: > >git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git device-msi > > This has been tested on Intel/AMD/KVM but lacks testing on: > > - HYPERV (-ENOD

Re: [patch RFC 10/38] x86/ioapic: Consolidate IOAPIC allocation

2020-08-26 Thread Boqun Feng
Hi Thomas, I hit a compiler error while I was trying to compile this patchset: arch/x86/kernel/devicetree.c: In function ‘dt_irqdomain_alloc’: arch/x86/kernel/devicetree.c:232:6: error: ‘struct irq_alloc_info’ has no member named ‘ioapic_id’; did you mean ‘ioapic’? 232 | tmp.ioapic_id = mpc_i

Re: [Xen-devel] [RFC 0/6] vDSO support for Hyper-V guest on ARM64

2020-01-27 Thread Boqun Feng
On Fri, Jan 24, 2020 at 10:24:44AM +, 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 &

Re: [Xen-devel] [RFC 0/6] vDSO support for Hyper-V guest on ARM64

2020-01-23 Thread Boqun Feng
Hi Vincenzo, On Thu, Jan 23, 2020 at 10:48:07AM +, Vincenzo Frascino wrote: > Hi Boqun Feng, > > sorry for the late reply. > That's OK, thanks for your review ;-) > On 16/12/2019 00:19, Boqun Feng wrote: > > Hi, > > > > This is the RFC patchset for v

Re: [Xen-devel] [RFC 6/6] arm64: hyperv: Enable vDSO

2019-12-17 Thread Boqun Feng
On Tue, Dec 17, 2019 at 03:10:16PM +0100, Vitaly Kuznetsov wrote: > Boqun Feng writes: > > > Similar to x86, add a new vclock_mode VCLOCK_HVCLOCK, and reuse the > > hv_read_tsc_page() for userspace to read tsc page clocksource. > > > > Signed-off-by: Boqun Feng

[Xen-devel] [RFC 5/6] arm64: hyperv: Enable userspace to read cntvct

2019-12-15 Thread Boqun Feng
Since reading hyperv-timer clocksource requires reading cntvct, userspace should be allowed to read it, otherwise reading cntvct will result in traps, which makes vsyscall's cost similar compared to syscall's. So enable it on every cpu when a Hyper-V guest booting up. Signed-off-by:

[Xen-devel] [RFC 0/6] vDSO support for Hyper-V guest on ARM64

2019-12-15 Thread Boqun Feng
Hi, This is the RFC patchset for vDSO support in ARM64 Hyper-V guest. To test it, Michael's ARM64 support patchset: https://lore.kernel.org/linux-arm-kernel/1570129355-16005-1-git-send-email-mikel...@microsoft.com/ is needed. Similar as x86, Hyper-V on ARM64 use a TSC page for guests t

[Xen-devel] [RFC 6/6] arm64: hyperv: Enable vDSO

2019-12-15 Thread Boqun Feng
Similar to x86, add a new vclock_mode VCLOCK_HVCLOCK, and reuse the hv_read_tsc_page() for userspace to read tsc page clocksource. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/include/asm/clocksource.h | 3 ++- arch/arm64/include/asm/mshyperv.h | 2 +- arch/arm64

[Xen-devel] [RFC 2/6] arm64: vdso: Add support for multiple vDSO data pages

2019-12-15 Thread Boqun Feng
userspace need to be adjusted with some data from a page maintained by the hypervisor. For example, the TSC page in Hyper-V. This is a prerequisite for vDSO support in ARM64 on Hyper-V. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/kernel/vdso.c | 43 1

[Xen-devel] [RFC 3/6] arm/arm64: clocksource: Introduce vclock_mode

2019-12-15 Thread Boqun Feng
driver and require arch_clocksource_data having the same field. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm/include/asm/clocksource.h| 6 +- arch/arm/kernel/vdso.c| 1 - arch/arm64/include/asm/clocksource.h | 6 +- arch/arm64

[Xen-devel] [RFC 1/6] arm64: hyperv: Allow hv_get_raw_timer() definition to be overridden

2019-12-15 Thread Boqun Feng
inter initialized (using a kernel address) by the arch timer driver, therefore not usable in vDSO. Fix this by allowing a previous definition to override the default one, so that in vDSO code, we can define it as a function callable in userspace. Signed-off-by: Boqun Feng (Microsoft) --- arch/

[Xen-devel] [RFC 4/6] arm64: vdso: hyperv: Map tsc page into vDSO if enabled

2019-12-15 Thread Boqun Feng
vDSO set-up in __vdso_init() to do this. Note: if HYPERV_TIMER=y but the kernel is using other clocksource or doesn't have the hyperv timer clocksource, tsc page will still be mapped into userspace. Signed-off-by: Boqun Feng (Microsoft) --- arch/arm64/kernel/vdso.c | 12

Re: [Xen-devel] [RFC PATCH v2 00/17] RFC: SGX Virtualization design and draft patches

2017-12-24 Thread Boqun Feng
On Mon, Dec 04, 2017 at 08:15:11AM +0800, Boqun Feng wrote: > Hi all, > > This is the v2 of RFC SGX Virtualization design and draft patches, you Ping ;-) Any comments? Regards, Boqun > can find v1 at: > > https://lists.gt.net/xen/devel/483404 > > In the new ver

Re: [Xen-devel] [PATCH v2 01/17] xen: x86: expose SGX to HVM domain in CPU featureset

2017-12-04 Thread Boqun Feng
On Mon, Dec 04, 2017 at 07:13:52AM -0700, Jan Beulich wrote: > >>> On 04.12.17 at 14:10, wrote: > > On Mon, Dec 04, 2017 at 11:13:45AM +, Julien Grall wrote: > >> I am not sure to understand why I am being CCed. But it looks like you CC > >> everyone on each patch... Please CC only relevant pe

Re: [Xen-devel] [PATCH v2 01/17] xen: x86: expose SGX to HVM domain in CPU featureset

2017-12-04 Thread Boqun Feng
et will provide more context for the reviewers. Will drop you from unrelevant patches in next verion. And I guess it's OK for me to drop you from replies on unrelevant patches of this version too? Regards, Boqun > Cheers, > > On 04/12/17 00:15, Boqun Feng wrote: > > From: Ka

[Xen-devel] [PATCH v2 16/17] xen: tools: add SGX to applying CPUID policy

2017-12-03 Thread Boqun Feng
From: Kai Huang In libxc, a new structure 'xc_cpuid_policy_build_info_t' is added to carry domain's EPC base and size info from libxl. libxl_cpuid_apply_policy is also changed to take 'libxl_domain_build_info_t' as parameter, where domain's EPC base and size can be got and passed to xc_cpuid_appl

[Xen-devel] [PATCH v2 17/17] xen: tools: add SGX to applying MSR policy

2017-12-03 Thread Boqun Feng
* If 'lehash' is set, set the domain's virtual IA32_SGXLEPUBKEYHASHn with its value, and later on the vcpu's virtual IA32_SGXLEPUBKEYHASHn will be set with the same value. If the physical IA32_SGXLEPUBKEYHASHn MSRs are not writable, using 'lehash' or 'lewr'

[Xen-devel] [PATCH v2 03/17] xen: vmx: detect ENCLS VMEXIT

2017-12-03 Thread Boqun Feng
From: Kai Huang If ENCLS VMEXIT is not present then we cannot support SGX virtualization. This patch detects presence of ENCLS VMEXIT, and disable SGX if ENCLS VMEXIT not present Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- xen/arch/x86/hvm/vmx/vmcs.c| 16

[Xen-devel] [PATCH v2 11/17] xen: vmx: handle SGX related MSRs

2017-12-03 Thread Boqun Feng
to physical MSRs when vcpu is scheduled in. Moreover, we cache the recent IA32_SGXLEPUBKEYHASHn in a percpu variable, so that we won't need to update with wrmsr if the value not changed. Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- xen/arch/x86/domctl.c| 28 -

[Xen-devel] [PATCH v2 01/17] xen: x86: expose SGX to HVM domain in CPU featureset

2017-12-03 Thread Boqun Feng
running in ring 3, or by PV ENCLS but it is really not necessary at this stage. SGX Launch Control is also exposed in CPU featureset for HVM domain. SGX Launch Control depends on SGX. Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- xen/include/public/arch-x86/cpufeatureset.h | 3 ++- xen

[Xen-devel] [PATCH v2 04/17] xen: x86/mm: introduce ioremap_wb()

2017-12-03 Thread Boqun Feng
: Boqun Feng --- xen/arch/x86/mm.c| 9 +++-- xen/include/asm-x86/mm.h | 7 +++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 886a5ee327df..db1d1f40 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5207,7 +5207,7

[Xen-devel] [PATCH v2 06/17] xen: mm: introduce non-scrubbable pages

2017-12-03 Thread Boqun Feng
and unscrubbable pages to get merged, therefore 'page_mergeable' is introduced, and it simply test whether two pages have the same scrubbable attributes. In 'scrub_one_page', scrubbing is aborted once the page is found unscrubbable. Signed-off-by: Boqun Feng --- xen/common/

[Xen-devel] [PATCH v2 14/17] xen: x86: reset EPC when guest got suspended.

2017-12-03 Thread Boqun Feng
From: Kai Huang EPC is destroyed when power state goes to S3-S5. Emulate this behavior. A new function s3_suspend is added to hvm_function_table for this purpose. Signed-off-by: Kai Huang --- xen/arch/x86/hvm/hvm.c| 3 +++ xen/arch/x86/hvm/vmx/vmx.c| 7 +++ xen/include/asm-x86

[Xen-devel] [PATCH v2 15/17] xen: tools: add new 'sgx' parameter support

2017-12-03 Thread Boqun Feng
are also added to 'xc_dom_image' in order to add EPC to e820 table. EPC base is calculated internally. Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- tools/libxc/include/xc_dom.h | 4 +++ tools/libxl/libxl_create.c | 10 ++ tools/libxl/libxl_dom.c | 30

[Xen-devel] [PATCH v2 12/17] xen: vmx: handle ENCLS VMEXIT

2017-12-03 Thread Boqun Feng
From: Kai Huang Currently EPC are statically allocated and mapped to guest, we don't have to trap ENCLS as it runs perfectly in VMX non-root mode. But exposing SGX to guest means we also expose ENABLE_ENCLS bit to L1 hypervisor, therefore we cannot stop L1 from enabling ENCLS VMEXIT. For ENCLS VM

[Xen-devel] [PATCH v2 08/17] xen: x86/mm: add SGX EPC management

2017-12-03 Thread Boqun Feng
need to do is to populate the portion of EPC pages in the 'frame_table' and set up the mapping properly. SGX would be disabled, if EPC initialization found any problem. Signed-off-by: Boqun Feng --- xen/arch/x86/sgx.c| 161 ++ xen/i

[Xen-devel] [PATCH v2 10/17] xen: x86: add SGX cpuid handling support.

2017-12-03 Thread Boqun Feng
h free EPC pages) results in domain creation failure by making XEN_DOMCTL_set_cpuid return error. Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- xen/arch/x86/cpuid.c| 62 - xen/arch/x86/domctl.c | 59

[Xen-devel] [PATCH v2 13/17] xen: vmx: handle VMEXIT from SGX enclave

2017-12-03 Thread Boqun Feng
From: Kai Huang VMX adds new bit to both exit_reason and GUEST_INTERRUPT_STATE to indicate whether VMEXIT happens in Enclave. Several instructions are also invalid or behave differently in enclave according to SDM. This patch handles those cases. Signed-off-by: Kai Huang --- xen/arch/x86/hvm/v

[Xen-devel] [PATCH v2 05/17] xen: p2m: new 'p2m_epc' type for EPC mapping

2017-12-03 Thread Boqun Feng
From: Kai Huang A new 'p2m_epc' type is added for EPC mapping type. Two wrapper functions set_epc_p2m_entry and clear_epc_p2m_entry are also added for further use. Signed-off-by: Kai Huang --- xen/arch/x86/mm/p2m-ept.c | 3 +++ xen/arch/x86/mm/p2m.c | 41 ++

[Xen-devel] [PATCH v2 07/17] xen: mm: manage EPC pages in Xen heaps

2017-12-03 Thread Boqun Feng
ntry of EPC pages in m2p table, as it's not used, so related setting is skipped. Besides, a 'MEMF_epc' memflag is introduced to tell the allocator to get EPC pages rather than normal memory. Signed-off-by: Boqun Feng --- xen/common/page_alloc.c | 31 +--

[Xen-devel] [RFC PATCH v2 00/17] RFC: SGX Virtualization design and draft patches

2017-12-03 Thread Boqun Feng
for those guests, destination VM will behavior in unexpected manner. But I am not sure we need to care about other OSes. For the same reason, we are able to support check pointing for SGX guest (only Linux and Windows); For snapshot, we can support snapshot SGX guest by either: - Suspend

[Xen-devel] [PATCH v2 09/17] xen: x86: add functions to populate and destroy EPC for domain

2017-12-03 Thread Boqun Feng
lid. Used when domain goes to S3-S5, or being destroyed. - domain_destroy_epc # destroy and free domain's EPC. For now, those functions only work for HVM domain, and will return -EFAULT if calling these for non-HVM domain. Signed-off-by: Kai Huang Signed

[Xen-devel] [PATCH v2 02/17] xen: x86: add early stage SGX feature detection

2017-12-03 Thread Boqun Feng
_has_sgx' should be the only way to query for the SGX support enabled or not in the whole system. Dedicated files sgx.c and sgx.h are added for bulk of above SGX detection code detection code, and for further SGX code as well. Signed-off-by: Kai Huang Signed-off-by: Boqun Feng --- docs/misc