Skip to contentSkip to conversation

x86emul: respect NSCB

PATCH In review Jan Beulich 3 participants 6 messages Sep 15, 2022 – Oct 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86emul: respect NSCB

protmode_load_seg() would better adhere to that "feature" of clearing base (and limit) during NULL selector loads.

xen/arch/x86/x86_emulate/x86_emulate.c +2 -1
@@ -1970,6 +1970,7 @@ amd_like(const struct x86_emulate_ctxt *
 #define vcpu_has_tbm()         (ctxt->cpuid->extd.tbm)
 #define vcpu_has_clzero()      (ctxt->cpuid->extd.clzero)
 #define vcpu_has_wbnoinvd()    (ctxt->cpuid->extd.wbnoinvd)
+#define vcpu_has_nscb()        (ctxt->cpuid->extd.nscb)
 
 #define vcpu_has_bmi1()        (ctxt->cpuid->feat.bmi1)
 #define vcpu_has_hle()         (ctxt->cpuid->feat.hle)
@@ -2102,7 +2103,7 @@ protmode_load_seg(
         case x86_seg_tr:
             goto raise_exn;
         }
-        if ( !_amd_like(cp) || !ops->read_segment ||
+        if ( !_amd_like(cp) || vcpu_has_nscb() || !ops->read_segment ||
              ops->read_segment(seg, sreg, ctxt) != X86EMUL_OKAY )
             memset(sreg, 0, sizeof(*sreg));
         else
#2 lore raw

[4.17?] Re: [PATCH] x86emul: respect NSCB

Quoted 7 lines · Andrew Cooper
Quoted 4 lines · Jan Beulich

protmode_load_seg() would better adhere to that "feature" of clearing base (and limit) during NULL selector loads.

Thanks.

Henry - this was submitted before the code freeze, so you weren't Cc-ed. May I ask to consider giving this a release ack?

Thanks, Jan

#3 lore raw

RE: [4.17?] Re: [PATCH] x86emul: respect NSCB

Hi Jan,

Quoted 9 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Subject: [4.17?] Re: [PATCH] x86emul: respect NSCB

Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Jan Beulich

protmode_load_seg() would better adhere to that "feature" of clearing base (and limit) during NULL selector loads.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Thanks.

Henry - this was submitted before the code freeze, so you weren't Cc-ed. May I ask to consider giving this a release ack?

Since this patch is simple and to my best knowledge this patch is trying to improve the code so:

(If it will not cause too much time of digging, would you mind adding a "Fixes:" tag pointing to the original commit that missing this vcpu_has_nscb() check when you do the committing? I think this would help to identify this patch as a bugfix so it is more reasonable to commit this patch in current phase. But if too much trouble or you think this is not really a fix then just ignore my comment...)

Kind regards,
Henry

Quoted 2 lines

Thanks, Jan

#4 lore raw

Re: [4.17?] Re: [PATCH] x86emul: respect NSCB

Quoted 20 lines · Henry Wang

Hi Jan,

Quoted 9 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Subject: [4.17?] Re: [PATCH] x86emul: respect NSCB

Quoted 4 lines · Andrew Cooper
Quoted 3 lines · Jan Beulich

protmode_load_seg() would better adhere to that "feature" of clearing base (and limit) during NULL selector loads.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Thanks.

Henry - this was submitted before the code freeze, so you weren't Cc-ed. May I ask to consider giving this a release ack?

Since this patch is simple and to my best knowledge this patch is trying to improve the code so:

Quoted 8 lines

(If it will not cause too much time of digging, would you mind adding a "Fixes:" tag pointing to the original commit that missing this vcpu_has_nscb() check when you do the committing? I think this would help to identify this patch as a bugfix so it is more reasonable to commit this patch in current phase. But if too much trouble or you think this is not really a fix then just ignore my comment...)

There isn't really an appropriate Fixes tag.

This CPUID bit is one I managed to get AMD to retroactively add to fix an enumeration problem they had no anticipated when making a change in Zen2.

i.e. the CPUID bit did not exist at the point at which the code, modified in this patch, was written.

~Andrew

#5 lore raw

RE: [4.17?] Re: [PATCH] x86emul: respect NSCB

Hi Andrew,

Quoted 9 lines

-----Original Message-----
From: Andrew Cooper <[email protected]>

Quoted 6 lines

(If it will not cause too much time of digging, would you mind adding a "Fixes:" tag pointing to the original commit that missing this vcpu_has_nscb() check when you do the committing? I think this would help to identify this patch as a bugfix so it is more reasonable to commit this patch in current phase. But if too much trouble or you think this is not really a fix then just ignore my comment...)

Quoted 8 lines

There isn't really an appropriate Fixes tag.

This CPUID bit is one I managed to get AMD to retroactively add to fix an enumeration problem they had no anticipated when making a change in Zen2.

i.e. the CPUID bit did not exist at the point at which the code, modified in this patch, was written.

Oh, thanks for the clarification! Then please just ignore my comments, sorry for the noise.

Kind regards,
Henry

Quoted 2 lines

~Andrew