Skip to content

Commit 7e740ae

Browse files
committed
Merge tag 'ras_core_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RAS updates from Borislav Petkov: "A relatively big amount of movements in RAS-land this time around: - First part of a series to move the AMD address translation code from arch/x86/ to amd64_edac as that is its only user anyway - Some MCE error injection improvements to the AMD side - Reorganization of the #MC handler code and the facilities it calls to make it noinstr-safe - Add support for new AMD MCA bank types and non-uniform banks layout - The usual set of cleanups and fixes" * tag 'ras_core_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) x86/mce: Reduce number of machine checks taken during recovery x86/mce/inject: Avoid out-of-bounds write when setting flags x86/MCE/AMD, EDAC/mce_amd: Support non-uniform MCA bank type enumeration x86/MCE/AMD, EDAC/mce_amd: Add new SMCA bank types x86/mce: Check regs before accessing it x86/mce: Mark mce_start() noinstr x86/mce: Mark mce_timed_out() noinstr x86/mce: Move the tainting outside of the noinstr region x86/mce: Mark mce_read_aux() noinstr x86/mce: Mark mce_end() noinstr x86/mce: Mark mce_panic() noinstr x86/mce: Prevent severity computation from being instrumented x86/mce: Allow instrumentation during task work queueing x86/mce: Remove noinstr annotation from mce_setup() x86/mce: Use mce_rdmsrl() in severity checking code x86/mce: Remove function-local cpus variables x86/mce: Do not use memset to clear the banks bitmaps x86/mce/inject: Set the valid bit in MCA_STATUS before error injection x86/mce/inject: Check if a bank is populated before injecting x86/mce: Get rid of cpu_missing ...
2 parents 48a60bd + 3376136 commit 7e740ae

File tree

12 files changed

+653
-375
lines changed

12 files changed

+653
-375
lines changed

arch/x86/include/asm/amd_nb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ extern int amd_set_subcaches(int, unsigned long);
2424

2525
extern int amd_smn_read(u16 node, u32 address, u32 *value);
2626
extern int amd_smn_write(u16 node, u32 address, u32 value);
27-
extern int amd_df_indirect_read(u16 node, u8 func, u16 reg, u8 instance_id, u32 *lo);
2827

2928
struct amd_l3_cache {
3029
unsigned indices;

arch/x86/include/asm/mce.h

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -313,48 +313,36 @@ enum smca_bank_types {
313313
SMCA_SMU, /* System Management Unit */
314314
SMCA_SMU_V2,
315315
SMCA_MP5, /* Microprocessor 5 Unit */
316+
SMCA_MPDMA, /* MPDMA Unit */
316317
SMCA_NBIO, /* Northbridge IO Unit */
317318
SMCA_PCIE, /* PCI Express Unit */
318319
SMCA_PCIE_V2,
319320
SMCA_XGMI_PCS, /* xGMI PCS Unit */
321+
SMCA_NBIF, /* NBIF Unit */
322+
SMCA_SHUB, /* System HUB Unit */
323+
SMCA_SATA, /* SATA Unit */
324+
SMCA_USB, /* USB Unit */
325+
SMCA_GMI_PCS, /* GMI PCS Unit */
320326
SMCA_XGMI_PHY, /* xGMI PHY Unit */
321327
SMCA_WAFL_PHY, /* WAFL PHY Unit */
328+
SMCA_GMI_PHY, /* GMI PHY Unit */
322329
N_SMCA_BANK_TYPES
323330
};
324331

325-
#define HWID_MCATYPE(hwid, mcatype) (((hwid) << 16) | (mcatype))
326-
327-
struct smca_hwid {
328-
unsigned int bank_type; /* Use with smca_bank_types for easy indexing. */
329-
u32 hwid_mcatype; /* (hwid,mcatype) tuple */
330-
u8 count; /* Number of instances. */
331-
};
332-
333-
struct smca_bank {
334-
struct smca_hwid *hwid;
335-
u32 id; /* Value of MCA_IPID[InstanceId]. */
336-
u8 sysfs_id; /* Value used for sysfs name. */
337-
};
338-
339-
extern struct smca_bank smca_banks[MAX_NR_BANKS];
340-
341332
extern const char *smca_get_long_name(enum smca_bank_types t);
342333
extern bool amd_mce_is_memory_error(struct mce *m);
343334

344335
extern int mce_threshold_create_device(unsigned int cpu);
345336
extern int mce_threshold_remove_device(unsigned int cpu);
346337

347338
void mce_amd_feature_init(struct cpuinfo_x86 *c);
348-
int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr);
349-
enum smca_bank_types smca_get_bank_type(unsigned int bank);
339+
enum smca_bank_types smca_get_bank_type(unsigned int cpu, unsigned int bank);
350340
#else
351341

352342
static inline int mce_threshold_create_device(unsigned int cpu) { return 0; };
353343
static inline int mce_threshold_remove_device(unsigned int cpu) { return 0; };
354344
static inline bool amd_mce_is_memory_error(struct mce *m) { return false; };
355345
static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { }
356-
static inline int
357-
umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr) { return -EINVAL; };
358346
#endif
359347

360348
static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c) { return mce_amd_feature_init(c); }

arch/x86/kernel/amd_nb.c

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define PCI_DEVICE_ID_AMD_19H_M40H_DF_F4 0x167d
3030
#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F4 0x166e
3131

32-
/* Protect the PCI config register pairs used for SMN and DF indirect access. */
32+
/* Protect the PCI config register pairs used for SMN. */
3333
static DEFINE_MUTEX(smn_mutex);
3434

3535
static u32 *flush_words;
@@ -182,53 +182,6 @@ int amd_smn_write(u16 node, u32 address, u32 value)
182182
}
183183
EXPORT_SYMBOL_GPL(amd_smn_write);
184184

185-
/*
186-
* Data Fabric Indirect Access uses FICAA/FICAD.
187-
*
188-
* Fabric Indirect Configuration Access Address (FICAA): Constructed based
189-
* on the device's Instance Id and the PCI function and register offset of
190-
* the desired register.
191-
*
192-
* Fabric Indirect Configuration Access Data (FICAD): There are FICAD LO
193-
* and FICAD HI registers but so far we only need the LO register.
194-
*/
195-
int amd_df_indirect_read(u16 node, u8 func, u16 reg, u8 instance_id, u32 *lo)
196-
{
197-
struct pci_dev *F4;
198-
u32 ficaa;
199-
int err = -ENODEV;
200-
201-
if (node >= amd_northbridges.num)
202-
goto out;
203-
204-
F4 = node_to_amd_nb(node)->link;
205-
if (!F4)
206-
goto out;
207-
208-
ficaa = 1;
209-
ficaa |= reg & 0x3FC;
210-
ficaa |= (func & 0x7) << 11;
211-
ficaa |= instance_id << 16;
212-
213-
mutex_lock(&smn_mutex);
214-
215-
err = pci_write_config_dword(F4, 0x5C, ficaa);
216-
if (err) {
217-
pr_warn("Error writing DF Indirect FICAA, FICAA=0x%x\n", ficaa);
218-
goto out_unlock;
219-
}
220-
221-
err = pci_read_config_dword(F4, 0x98, lo);
222-
if (err)
223-
pr_warn("Error reading DF Indirect FICAD LO, FICAA=0x%x.\n", ficaa);
224-
225-
out_unlock:
226-
mutex_unlock(&smn_mutex);
227-
228-
out:
229-
return err;
230-
}
231-
EXPORT_SYMBOL_GPL(amd_df_indirect_read);
232185

233186
int amd_cache_northbridges(void)
234187
{

0 commit comments

Comments
 (0)