Re: [PATCH v3 4/7] arm64: hyperv: Boot in a Virtual Trust Level

2024-08-02 Thread Wei Liu
On Fri, Jul 26, 2024 at 03:59:07PM -0700, Roman Kisel wrote: > To run in the VTL mode, Hyper-V drivers have to know what > VTL the system boots in, and the arm64/hyperv code does not > update the variable that stores the value. > > Update the variable to enable the Hyper-V drivers to boot > in the

Re: [PATCH v3 3/7] Drivers: hv: Provide arch-neutral implementation of get_vtl()

2024-08-02 Thread Wei Liu
On Fri, Jul 26, 2024 at 03:59:06PM -0700, Roman Kisel wrote: > To run in the VTL mode, Hyper-V drivers have to know what > VTL the system boots in, and the arm64/hyperv code does not > have the means to compute that. > > Refactor the code to hoist the function that detects VTL, > make it arch-neut

Re: [PATCH v3 2/7] Drivers: hv: Enable VTL mode for arm64

2024-08-02 Thread Wei Liu
On Fri, Jul 26, 2024 at 03:59:05PM -0700, Roman Kisel wrote: > Kconfig dependencies for arm64 guests on Hyper-V require that be ACPI enabled, > and limit VTL mode to x86/x64. To enable VTL mode on arm64 as well, update the > dependencies. Since VTL mode requires DeviceTree instead of ACPI, don’t >

Re: [PATCH v3 1/7] arm64: hyperv: Use SMC to detect hypervisor presence

2024-08-02 Thread Wei Liu
On Fri, Jul 26, 2024 at 03:59:04PM -0700, Roman Kisel wrote: > The arm64 Hyper-V startup path relies on ACPI to detect > running under a Hyper-V compatible hypervisor. That > doesn't work on non-ACPI systems. > > Hoist the ACPI detection logic into a separate function, > use the new SMC added rece

Re: [PATCH v3 7/7] PCI: hv: Get vPCI MSI IRQ domain from DT

2024-08-02 Thread Wei Liu
On Fri, Jul 26, 2024 at 03:59:10PM -0700, Roman Kisel wrote: > The hyperv-pci driver uses ACPI for MSI IRQ domain configuration on > arm64. It won't be able to do that in the VTL mode where only DeviceTree > can be used. > > Update the hyperv-pci driver to get vPCI MSI IRQ domain in the DeviceTree

Re: [PATCH] Drivers: hv: vmbus: Fix the misplaced function description

2024-08-02 Thread Wei Liu
On Fri, Aug 02, 2024 at 03:51:37PM +, Michael Kelley wrote: > From: Roman Kisel Sent: Thursday, August 1, 2024 > 2:23 PM > > > > When hv_synic_disable_regs was introduced, it received the description > > of hv_synic_cleanup. Fix that. > > > > Fixes: dba61cda3046 ("Drivers: hv: vmbus: Break

Re: [PATCH v2] tools: hv: lsvmbus: change shebang to use python3

2024-08-02 Thread Wei Liu
On Wed, Jul 03, 2024 at 04:44:05PM +, Michael Kelley wrote: > From: Anthony Nandaa Sent: Tuesday, July 2, 2024 3:23 > AM > > Signed-off-by: Anthony Nandaa > > Reviewed-by: Michael Kelley > > Reviewed-by: Michael Kelley Applied to hyperv-fixes. Thanks.

Re: [PATCH 1/1] x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency

2024-08-02 Thread Wei Liu
On Tue, Jun 11, 2024 at 07:51:48AM -0700, Roman Kisel wrote: > > > On 6/5/2024 7:55 PM, mhkelle...@gmail.com wrote: > > From: Michael Kelley > > > > A Linux guest on Hyper-V gets the TSC frequency from a synthetic MSR, if > > available. In this case, set X86_FEATURE_TSC_KNOWN_FREQ so that Linux

Re: [PATCH 1/2] i8253: Disable PIT timer 0 when not in use

2024-08-02 Thread David Woodhouse
On Fri, 2024-08-02 at 15:44 +, Michael Kelley wrote: > Did a basic smoke test of this two-patch series on a Hyper-V Gen 1 > VM and on a Gen 2 VM. All looks good and behaves as expected. > > On the Gen 1 VM, the PIT is used briefly at boot (takes ~35 interrupts) > before the Hyper-V synthetic t

RE: [PATCH] Drivers: hv: vmbus: Fix the misplaced function description

2024-08-02 Thread Michael Kelley
From: Roman Kisel Sent: Thursday, August 1, 2024 2:23 PM > > When hv_synic_disable_regs was introduced, it received the description > of hv_synic_cleanup. Fix that. > > Fixes: dba61cda3046 ("Drivers: hv: vmbus: Break out synic enable and disable > operations") > > Signed-off-by: Roman Kisel >

RE: [PATCH 1/2] i8253: Disable PIT timer 0 when not in use

2024-08-02 Thread Michael Kelley
From: David Woodhouse Sent: Friday, August 2, 2024 6:56 AM > > Leaving the PIT interrupt running can cause noticeable steal time for > virtual guests. The VMM generally has a timer which toggles the IRQ input > to the PIC and I/O APIC, which takes CPU time away from the guest. Even > on real hard

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Fri, 2024-08-02 at 07:55 -0700, Sean Christopherson wrote: > On Fri, Aug 02, 2024, David Woodhouse wrote: > > On Thu, 2024-08-01 at 20:54 +0200, Thomas Gleixner wrote: > > > On Thu, Aug 01 2024 at 16:14, Michael Kelley wrote: > > > > I don't have a convenient way to test my sequence on KVM. > >

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread Sean Christopherson
On Fri, Aug 02, 2024, David Woodhouse wrote: > On Thu, 2024-08-01 at 20:54 +0200, Thomas Gleixner wrote: > > On Thu, Aug 01 2024 at 16:14, Michael Kelley wrote: > > > I don't have a convenient way to test my sequence on KVM. > > > > But still fails in KVM > > By KVM you mean the in-kernel one tha

[PATCH 1/2] i8253: Disable PIT timer 0 when not in use

2024-08-02 Thread David Woodhouse
From: David Woodhouse Leaving the PIT interrupt running can cause noticeable steal time for virtual guests. The VMM generally has a timer which toggles the IRQ input to the PIC and I/O APIC, which takes CPU time away from the guest. Even on real hardware, running the counter may use power needles

[PATCH 2/2] i8253: Fix stop sequence for timer 0

2024-08-02 Thread David Woodhouse
From: David Woodhouse According to the data sheet, writing the MODE register should stop the counter (and thus the interrupts). This appears to work on real hardware, at least modern Intel and AMD systems. It should also work on Hyper-V. However, on some buggy virtual machines the mode change do

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Fri, 2024-08-02 at 15:27 +0200, Thomas Gleixner wrote: > > Top two commits of > > https://git.infradead.org/users/dwmw2/linux.git/shortlog/refs/heads/clocks > > > > I'll repost properly if you're happy with them? > > Just make the disable unconditional. Oops, thought I'd done that too. Turns

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread Thomas Gleixner
On Fri, Aug 02 2024 at 12:04, David Woodhouse wrote: > On Fri, 2024-08-02 at 12:49 +0200, Thomas Gleixner wrote: >> So fine, we can go with the patch from Li, but the changelog needs a >> rewrite and the code want's a big fat comment. > > Nah, it wants to be MODE, COUNT, COUNT, MODE to handle all k

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Fri, 2024-08-02 at 12:49 +0200, Thomas Gleixner wrote: > On Fri, Aug 02 2024 at 09:07, David Woodhouse wrote: > > On Thu, 2024-08-01 at 20:57 +0200, Thomas Gleixner wrote: > > > It's not counting right out of reset. But once it started counting it's > > > tedious to stop :) > > > > My reading o

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread Thomas Gleixner
On Fri, Aug 02 2024 at 09:07, David Woodhouse wrote: > On Thu, 2024-08-01 at 20:57 +0200, Thomas Gleixner wrote: >> It's not counting right out of reset. But once it started counting it's >> tedious to stop :) > > My reading of the data sheet definitely suggests that it *shouldn't* > be. > > Mode 0

[PATCH 2/1] i8253: Fix stop sequence for timer 0

2024-08-02 Thread David Woodhouse
From: David Woodhouse According to the data sheet, writing the MODE register should stop the counter (and thus the interrupts). This appears to work on real hardware, at least modern Intel and AMD systems. It should also work on Hyper-V. However, on some buggy virtual machines the mode change do

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Thu, 2024-08-01 at 22:31 +0100, David Woodhouse wrote: > On 1 August 2024 22:22:56 BST, Thomas Gleixner wrote: > > On Thu, Aug 01 2024 at 21:49, David Woodhouse wrote: > > > On Thu, 2024-08-01 at 22:00 +0200, Thomas Gleixner wrote: > > > > > I justify my cowardice on the basis that it doesn't *

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Thu, 2024-08-01 at 20:54 +0200, Thomas Gleixner wrote: > On Thu, Aug 01 2024 at 16:14, Michael Kelley wrote: > > From: Thomas Gleixner Sent: Thursday, August > > 1, 2024 7:21 AM > > FWIW, in Hyper-V guests with the Hyper-V quirk removed, tglx's new > > sequence does *not* stop the PIT. But this

Re: [PATCH] clockevents/drivers/i8253: Do not zero timer counter in shutdown

2024-08-02 Thread David Woodhouse
On Thu, 2024-08-01 at 20:57 +0200, Thomas Gleixner wrote: > On Thu, Aug 01 2024 at 19:25, David Woodhouse wrote: > > On Thu, 2024-08-01 at 18:49 +0100, David Woodhouse wrote: > > > > The stop sequence is wrong: > > > > > > > >     When there is a count in progress, writing a new LSB before the > >