The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH v2 0/2] x86/tdx: Port I/O emulation fixes
       [not found] <20260428125632.129770-1-kas@kernel.org>
@ 2026-05-08 22:52 ` Kiryl Shutsemau
  2026-05-08 22:53   ` Dave Hansen
       [not found] ` <20260428125632.129770-3-kas@kernel.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Kiryl Shutsemau @ 2026-05-08 22:52 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H . Peter Anvin, Rick Edgecombe, Kuppuswamy Sathyanarayanan,
	Kai Huang, Borys Tsyrulnikov, linux-kernel, linux-coco, kvm,
	stable

On Tue, Apr 28, 2026 at 01:56:30PM +0100, Kiryl Shutsemau (Meta) wrote:
> Kiryl Shutsemau (Meta) (2):
>   x86/tdx: Fix off-by-one in port I/O handling
>   x86/tdx: Fix zero-extension for 32-bit port I/O

Dave, could get them applied?

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] x86/tdx: Port I/O emulation fixes
  2026-05-08 22:52 ` [PATCH v2 0/2] x86/tdx: Port I/O emulation fixes Kiryl Shutsemau
@ 2026-05-08 22:53   ` Dave Hansen
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Hansen @ 2026-05-08 22:53 UTC (permalink / raw)
  To: Kiryl Shutsemau, Dave Hansen
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H . Peter Anvin, Rick Edgecombe, Kuppuswamy Sathyanarayanan,
	Kai Huang, Borys Tsyrulnikov, linux-kernel, linux-coco, kvm,
	stable

On 5/8/26 15:52, Kiryl Shutsemau wrote:
> On Tue, Apr 28, 2026 at 01:56:30PM +0100, Kiryl Shutsemau (Meta) wrote:
>> Kiryl Shutsemau (Meta) (2):
>>   x86/tdx: Fix off-by-one in port I/O handling
>>   x86/tdx: Fix zero-extension for 32-bit port I/O
> Dave, could get them applied?

I'll look on Monday. Thanks for the reminder.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O
       [not found] ` <20260428125632.129770-3-kas@kernel.org>
@ 2026-05-13  1:14   ` Dave Hansen
  2026-05-13  2:32     ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Hansen @ 2026-05-13  1:14 UTC (permalink / raw)
  To: Kiryl Shutsemau (Meta), Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86
  Cc: H . Peter Anvin, Rick Edgecombe, Kuppuswamy Sathyanarayanan,
	Kai Huang, Borys Tsyrulnikov, linux-kernel, linux-coco, kvm,
	stable

On 4/28/26 05:56, Kiryl Shutsemau (Meta) wrote:
> +	if (size == 4)
> +		regs->ax = 0;
> +	else
> +		regs->ax &= ~mask;

I haven't thought about this _that_ much, but this feels wrong. Why is
is 4 so special cased?

Also, what _are_ the limits on the registers that 'in' can be used on?

RAX - n/a, no 64-bit I/O
EAX - size=4
AX  - size=2
AH  - n/a no encoding for inb
AL  - size=1

I'd find this much easier to grasp if there was a nice table of what the
registers, sizes, and masks ended up being usable. As usual, x86 is
"fun" here.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O
  2026-05-13  1:14   ` [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O Dave Hansen
@ 2026-05-13  2:32     ` H. Peter Anvin
  2026-05-13 12:48       ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2026-05-13  2:32 UTC (permalink / raw)
  To: Dave Hansen, Kiryl Shutsemau (Meta), Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86
  Cc: Rick Edgecombe, Kuppuswamy Sathyanarayanan, Kai Huang,
	Borys Tsyrulnikov, linux-kernel, linux-coco, kvm, stable

On May 12, 2026 6:14:13 PM PDT, Dave Hansen <dave.hansen@intel.com> wrote:
>On 4/28/26 05:56, Kiryl Shutsemau (Meta) wrote:
>> +	if (size == 4)
>> +		regs->ax = 0;
>> +	else
>> +		regs->ax &= ~mask;
>
>I haven't thought about this _that_ much, but this feels wrong. Why is
>is 4 so special cased?
>
>Also, what _are_ the limits on the registers that 'in' can be used on?
>
>RAX - n/a, no 64-bit I/O
>EAX - size=4
>AX  - size=2
>AH  - n/a no encoding for inb
>AL  - size=1
>
>I'd find this much easier to grasp if there was a nice table of what the
>registers, sizes, and masks ended up being usable. As usual, x86 is
>"fun" here.

Because zero extension only applies to dwords.

x86-64 has three subregisters per GPR:

Bits 7-0
Bits 15-8
Bits 63-16

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O
  2026-05-13  2:32     ` H. Peter Anvin
@ 2026-05-13 12:48       ` Sean Christopherson
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2026-05-13 12:48 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Dave Hansen, Kiryl Shutsemau (Meta), Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, Rick Edgecombe,
	Kuppuswamy Sathyanarayanan, Kai Huang, Borys Tsyrulnikov,
	linux-kernel, linux-coco, kvm, stable

On Tue, May 12, 2026, H. Peter Anvin wrote:
> On May 12, 2026 6:14:13 PM PDT, Dave Hansen <dave.hansen@intel.com> wrote:
> >On 4/28/26 05:56, Kiryl Shutsemau (Meta) wrote:
> >> +	if (size == 4)
> >> +		regs->ax = 0;
> >> +	else
> >> +		regs->ax &= ~mask;
> >
> >I haven't thought about this _that_ much, but this feels wrong. Why is
> >is 4 so special cased?
> >
> >Also, what _are_ the limits on the registers that 'in' can be used on?
> >
> >RAX - n/a, no 64-bit I/O
> >EAX - size=4
> >AX  - size=2
> >AH  - n/a no encoding for inb
> >AL  - size=1
> >
> >I'd find this much easier to grasp if there was a nice table of what the
> >registers, sizes, and masks ended up being usable. As usual, x86 is
> >"fun" here.
> 
> Because zero extension only applies to dwords.
> 
> x86-64 has three subregisters per GPR:

Aren't there four?  The fourth being 31:0, which is the one that is zero-extended
and so "clobbers" 63:32.

> Bits 7-0
> Bits 15-8
> Bits 63-16

I assume you mean 15:0?  63:16 isn't addressable.  And these are the ones that
aren't zero-extended, i.e. don't "clobber" other bits.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-13 12:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260428125632.129770-1-kas@kernel.org>
2026-05-08 22:52 ` [PATCH v2 0/2] x86/tdx: Port I/O emulation fixes Kiryl Shutsemau
2026-05-08 22:53   ` Dave Hansen
     [not found] ` <20260428125632.129770-3-kas@kernel.org>
2026-05-13  1:14   ` [PATCH v2 2/2] x86/tdx: Fix zero-extension for 32-bit port I/O Dave Hansen
2026-05-13  2:32     ` H. Peter Anvin
2026-05-13 12:48       ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox