mirror of
https://github.com/torvalds/linux.git
synced 2024-12-01 00:21:32 +00:00
x86/platform/uv: Account for UV Hubless in is_uvX_hub Ops
The references in the is_uvX_hub() function uses the hub_info pointer which will be NULL when the system is hubless. This change avoids that NULL dereference. It is also an optimization in performance. Signed-off-by: Mike Travis <mike.travis@hpe.com> Reviewed-by: Steve Wahl <steve.wahl@hpe.com> Reviewed-by: Dimitri Sivanich <dimitri.sivanich@hpe.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Christoph Hellwig <hch@infradead.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Hedi Berriche <hedi.berriche@hpe.com> Cc: Justin Ernst <justin.ernst@hpe.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <russ.anderson@hpe.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20190910145840.294981941@stormcage.eag.rdlabs.hpecorp.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
df55029f7e
commit
4fb7d08707
@ -19,6 +19,7 @@
|
|||||||
#include <linux/topology.h>
|
#include <linux/topology.h>
|
||||||
#include <asm/types.h>
|
#include <asm/types.h>
|
||||||
#include <asm/percpu.h>
|
#include <asm/percpu.h>
|
||||||
|
#include <asm/uv/uv.h>
|
||||||
#include <asm/uv/uv_mmrs.h>
|
#include <asm/uv/uv_mmrs.h>
|
||||||
#include <asm/uv/bios.h>
|
#include <asm/uv/bios.h>
|
||||||
#include <asm/irq_vectors.h>
|
#include <asm/irq_vectors.h>
|
||||||
@ -243,83 +244,61 @@ static inline int uv_hub_info_check(int version)
|
|||||||
#define UV4_HUB_REVISION_BASE 7
|
#define UV4_HUB_REVISION_BASE 7
|
||||||
#define UV4A_HUB_REVISION_BASE 8 /* UV4 (fixed) rev 2 */
|
#define UV4A_HUB_REVISION_BASE 8 /* UV4 (fixed) rev 2 */
|
||||||
|
|
||||||
|
/* WARNING: UVx_HUB_IS_SUPPORTED defines are deprecated and will be removed */
|
||||||
|
static inline int is_uv1_hub(void)
|
||||||
|
{
|
||||||
#ifdef UV1_HUB_IS_SUPPORTED
|
#ifdef UV1_HUB_IS_SUPPORTED
|
||||||
static inline int is_uv1_hub(void)
|
return is_uv_hubbed(uv(1));
|
||||||
{
|
|
||||||
return uv_hub_info->hub_revision < UV2_HUB_REVISION_BASE;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline int is_uv1_hub(void)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int is_uv2_hub(void)
|
||||||
|
{
|
||||||
#ifdef UV2_HUB_IS_SUPPORTED
|
#ifdef UV2_HUB_IS_SUPPORTED
|
||||||
static inline int is_uv2_hub(void)
|
return is_uv_hubbed(uv(2));
|
||||||
{
|
|
||||||
return ((uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE) &&
|
|
||||||
(uv_hub_info->hub_revision < UV3_HUB_REVISION_BASE));
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline int is_uv2_hub(void)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int is_uv3_hub(void)
|
||||||
|
{
|
||||||
#ifdef UV3_HUB_IS_SUPPORTED
|
#ifdef UV3_HUB_IS_SUPPORTED
|
||||||
static inline int is_uv3_hub(void)
|
return is_uv_hubbed(uv(3));
|
||||||
{
|
|
||||||
return ((uv_hub_info->hub_revision >= UV3_HUB_REVISION_BASE) &&
|
|
||||||
(uv_hub_info->hub_revision < UV4_HUB_REVISION_BASE));
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline int is_uv3_hub(void)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* First test "is UV4A", then "is UV4" */
|
/* First test "is UV4A", then "is UV4" */
|
||||||
|
static inline int is_uv4a_hub(void)
|
||||||
|
{
|
||||||
#ifdef UV4A_HUB_IS_SUPPORTED
|
#ifdef UV4A_HUB_IS_SUPPORTED
|
||||||
static inline int is_uv4a_hub(void)
|
if (is_uv_hubbed(uv(4)))
|
||||||
{
|
return (uv_hub_info->hub_revision == UV4A_HUB_REVISION_BASE);
|
||||||
return (uv_hub_info->hub_revision >= UV4A_HUB_REVISION_BASE);
|
#endif
|
||||||
}
|
|
||||||
#else
|
|
||||||
static inline int is_uv4a_hub(void)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
static inline int is_uv4_hub(void)
|
||||||
|
{
|
||||||
#ifdef UV4_HUB_IS_SUPPORTED
|
#ifdef UV4_HUB_IS_SUPPORTED
|
||||||
static inline int is_uv4_hub(void)
|
return is_uv_hubbed(uv(4));
|
||||||
{
|
|
||||||
return uv_hub_info->hub_revision >= UV4_HUB_REVISION_BASE;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static inline int is_uv4_hub(void)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static inline int is_uvx_hub(void)
|
static inline int is_uvx_hub(void)
|
||||||
{
|
{
|
||||||
if (uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE)
|
return (is_uv_hubbed(-2) >= uv(2));
|
||||||
return uv_hub_info->hub_revision;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_uv_hub(void)
|
static inline int is_uv_hub(void)
|
||||||
{
|
{
|
||||||
#ifdef UV1_HUB_IS_SUPPORTED
|
return is_uv1_hub() || is_uvx_hub();
|
||||||
return uv_hub_info->hub_revision;
|
|
||||||
#endif
|
|
||||||
return is_uvx_hub();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
union uvh_apicid {
|
union uvh_apicid {
|
||||||
|
Loading…
Reference in New Issue
Block a user