On Thu, 7 Mar 2024 08:46:49 -0600 Ben Cheatham <benjamin.cheatham@xxxxxxx> wrote: > Hey Jonathan, thanks for taking a look! > > On 3/7/24 6:09 AM, Jonathan Cameron wrote: > > On Mon, 26 Feb 2024 16:27:02 -0600 > > Ben Cheatham <Benjamin.Cheatham@xxxxxxx> wrote: > > > >> Remove CXL protocol error types from the EINJ module and move them to > >> a new einj_cxl module. The einj_cxl module implements the necessary > >> handling for CXL protocol error injection and exposes an API for the > >> CXL core to use said functionality. Because the CXL error types > >> require special handling, only allow them to be injected through the > >> einj_cxl module and return an error when attempting to inject through > >> "regular" EINJ. > >> > >> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@xxxxxxx> > > Hi Ben, > > > > Some minor comments inline given you are doing a v15 (yikes!) > > > > Yeah I know :(. > With headers tidied up. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > > > > >> + { BIT(13), "CXL.cache Protocol Uncorrectable non-fatal" }, > >> + { BIT(14), "CXL.cache Protocol Uncorrectable fatal" }, > >> + { BIT(15), "CXL.mem Protocol Correctable" }, > >> + { BIT(16), "CXL.mem Protocol Uncorrectable non-fatal" }, > >> + { BIT(17), "CXL.mem Protocol Uncorrectable fatal" }, > >> +}; > >> + > >> +int einj_cxl_available_error_type_show(struct seq_file *m, void *v) > >> +{ > >> + int cxl_err, rc; > >> + u32 available_error_type = 0; > >> + > >> + if (!einj_initialized) > >> + return -ENXIO; > >> + > >> + rc = einj_get_available_error_type(&available_error_type); > >> + if (rc) > >> + return rc; > >> + > >> + for (int pos = 0; pos < ARRAY_SIZE(einj_cxl_error_type_string); pos++) { > >> + cxl_err = ACPI_EINJ_CXL_CACHE_CORRECTABLE << pos; > > Hmm. This is a little ugly. > > Could do something like the following bit it's of similar level of ugly > > so up to you. > > > > int bit_pos = ACPI_EINJ_CXL_CACHE_CORRECTABLE; > > for_each_bit_set_bit_from(bit_pos, &available_error_type, > > ARRAY_SIZE(einj_cxl_error_type_string)) { > > int pos = bit_pos - ACPI_EINJ_CXL_CACHE_CORRECTABLE; > > > > I agree it's ugly. I think this version has the added benfit of parity > with einj_available_error_type_show() in einj-core.c, so I think it's > better to keep it this way if it's the same to you. > Sure. We can always (maybe) tidy them both up later :) J