Message ID | 20241023172150.659002-3-yazen.ghannam@amd.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | AMD NB and SMN rework | expand |
> From: Yazen Ghannam <yazen.ghannam@amd.com> > [..] > --- a/arch/x86/kernel/amd_nb.c > +++ b/arch/x86/kernel/amd_nb.c > @@ -582,6 +582,10 @@ static __init void fix_erratum_688(void) > > static __init int init_amd_nbs(void) > { > + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && > + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) > + return 0; > + > amd_cache_northbridges(); This function could fail and return an error. Is an early return with an error code needed if this function fails? [ I know this is out of this patch scope. ] > amd_cache_gart(); -Qiuxu
On Thu, Oct 31, 2024 at 08:09:14AM +0000, Zhuo, Qiuxu wrote: > This function could fail and return an error. > Is an early return with an error code needed if this function fails? No, grep for amd_northbridges.num checks in the code.
> From: Borislav Petkov <bp@alien8.de> > [...] > > On Thu, Oct 31, 2024 at 08:09:14AM +0000, Zhuo, Qiuxu wrote: > > This function could fail and return an error. > > Is an early return with an error code needed if this function fails? > > No, grep for amd_northbridges.num checks in the code. If the return value of amd_cache_northbridges() isn't used in any place, make it return void? -Qiuxu
On October 31, 2024 12:50:10 PM GMT+01:00, "Zhuo, Qiuxu" <qiuxu.zhuo@intel.com> wrote: >> From: Borislav Petkov <bp@alien8.de> >> [...] >> >> On Thu, Oct 31, 2024 at 08:09:14AM +0000, Zhuo, Qiuxu wrote: >> > This function could fail and return an error. >> > Is an early return with an error code needed if this function fails? >> >> No, grep for amd_northbridges.num checks in the code. > >If the return value of amd_cache_northbridges() isn't used in any place, >make it return void? > >-Qiuxu Feel free to propose patches *after* the dust around that area settles.
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 9fe9972d2071..37b8244899d8 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c @@ -582,6 +582,10 @@ static __init void fix_erratum_688(void) static __init int init_amd_nbs(void) { + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && + boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) + return 0; + amd_cache_northbridges(); amd_cache_gart();
The code implicitly operates on AMD-based systems by matching on PCI IDs. However, the use of these IDs is going away. Add an explicit CPU vendor check instead of relying on PCI IDs. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> --- arch/x86/kernel/amd_nb.c | 4 ++++ 1 file changed, 4 insertions(+)