[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v1 2/2] x86/amd: optional build of amd.c


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Sergiy Kibrik <sergiy_kibrik@xxxxxxxx>
  • Date: Thu, 15 Aug 2024 13:13:48 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KA9utaxHJXkM8L3oh6OBEMf86CJfyD1O7lD4HEeri0g=; b=pgWub1WTBrJ85bF0kToFuva5JXAV5IUQGykCrWfl8ySSQYmO+gAdaQSCKinHxmAMtAf0fm262hskLuhc5tKFeIgSHOu27a1BNuioo3M+YSHXbfgqIF4aJTSonDTktfvHdPUd2xehiaBLetnZw6qeaCj0Hpku7B8tWFJd+ZIHw2vGZ+NK3lDt4Nl8hGaCj9u0IhAuGcFRM4Q4DXCWH4oIBovpywPHYctcrRaZIoIfK99zcaKZ1mKxvOLQQYZ4BWpYyYCJwA5dtdUIPmlRKhRGU9zJ0ZqV8C397wlre3+f34dEFMcoB/hGw4n08tXdzgQqy6tPLTZQbZNI41zfJTdiWA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=om8u9pm+dY0houmDq+AreZzG3xNRsyCad7wnktecoiWbrnFDOIb0mH2pafXOIv4ibaqaxwPdg1BQpc0Ir9xpJwDxlv7+M/mpe/boj3p2fjXs4+WahsUObkqssI8f+hy1gcuZgrRpg4f/qiaa8ZUtYFo9B+O4aZwSdiFtircIzyhyajwL8qBjZ3nUBu5r/JhjLMU+SzIBsewkx2zKXQ5fys+WCuEBpOkSli2LzAz5ehDj0+iwp4WvTcWcs7zmycWjtxqsiF6PIlbuF0fT5dn/bu00ECMrpbgMq68mxaBvKXVo6tl7oXjUDBY7j2fONFMVj9BMSL24SgjUdNci1uybOw==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 15 Aug 2024 10:14:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

13.08.24 10:50, Jan Beulich:
On 09.08.2024 12:11, Sergiy Kibrik wrote:
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -158,13 +158,21 @@
  #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
struct cpuinfo_x86;
+#ifdef CONFIG_AMD
  int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
+#else
+static inline int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int 
osvw_id, ...)

Nit: Too long line.

+{
+    return false;

I wouldn't mind if you consistently changed the function to return
bool, but as long as it returns int I don't think it should be returning
false.


indeed, it should return 0

@@ -173,5 +181,19 @@ extern bool amd_virt_spec_ctrl;
  bool amd_setup_legacy_ssbd(void);
  void amd_set_legacy_ssbd(bool enable);
  void amd_set_cpuid_user_dis(bool enable);
+#else
+static inline void amd_set_cpuid_user_dis(bool enable) {}
+static inline void amd_set_legacy_ssbd(bool enable) {}
+static inline bool amd_setup_legacy_ssbd(void)
+{
+    return false;
+}

Nit: Would be a little nicer if these were in the same order as their
corresponding declarations. However, along the lines of one of my
comments on the Intel counterpart patch ...

+#define amd_acpi_c1e_quirk (false)
+#define amd_virt_spec_ctrl (false)
+#define amd_legacy_ssbd (false)
+
+static inline void amd_check_disable_c1e(unsigned int port, u8 value) {}
+#endif

... question overall is how many of these stubs are really required,
once clearly AMD-only code is properly taken care of (perhaps not just
in spec_ctrl.c).


most of these functions-stubs can go away, though it'll require more CONFIG_AMD checks at call sites, and more patches probably.

  -Sergiy



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.