Skip to content

Commit

Permalink
pci: recheck pci nvram hacks on fast-reboot
Browse files Browse the repository at this point in the history
Sometimes it's useful to fiddle with some of the PCI NVRAM options that
we have. Currently this is mostly for enabling and disabling pci-tracing
mode, but having a common place for this stuff is a good idea.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
  • Loading branch information
oohal committed Aug 23, 2019
1 parent 2a0455b commit 1af237b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions core/fast-reboot.c
Expand Up @@ -433,6 +433,9 @@ void __noreturn fast_reboot_entry(void)
psi_irq_reset();
}

/* update pci nvram settings */
pci_nvram_init();

/* Remove all PCI devices */
if (pci_reset()) {
prlog(PR_NOTICE, "RESET: Fast reboot failed to reset PCI\n");
Expand Down
5 changes: 4 additions & 1 deletion core/init.c
Expand Up @@ -48,6 +48,7 @@

enum proc_gen proc_gen;
unsigned int pcie_max_link_speed;
bool pci_tracing;
bool verbose_eeh;
extern const char version[];

Expand Down Expand Up @@ -844,7 +845,7 @@ static void per_thread_sanity_checks(void)
assert(cpu->state != cpu_state_no_cpu);
}

static void pci_nvram_init(void)
void pci_nvram_init(void)
{
const char *nvram_speed;

Expand All @@ -860,6 +861,8 @@ static void pci_nvram_init(void)
prlog(PR_NOTICE, "PHB: NVRAM set max link speed to GEN%i\n",
pcie_max_link_speed);
}

pci_tracing = nvram_query_eq_safe("pci-tracing", "true");
}

static uint32_t mem_csum(void *_p, void *_e)
Expand Down
2 changes: 0 additions & 2 deletions hw/phb4.c
Expand Up @@ -138,7 +138,6 @@ static void phb4_init_hw(struct phb4 *p);

#define PHB4_CAN_STORE_EOI(p) XIVE_STORE_EOI_ENABLED

static bool pci_tracing;
static bool pci_eeh_mmio;
static bool pci_retry_all;
static int rx_err_max = PHB4_RX_ERR_MAX;
Expand Down Expand Up @@ -5946,7 +5945,6 @@ void probe_phb4(void)
struct dt_node *np;
const char *s;

pci_tracing = nvram_query_eq_safe("pci-tracing", "true");
pci_eeh_mmio = !nvram_query_eq_dangerous("pci-eeh-mmio", "disabled");
pci_retry_all = nvram_query_eq_dangerous("pci-retry-all", "true");
s = nvram_query_dangerous("phb-rx-err-max");
Expand Down
5 changes: 4 additions & 1 deletion include/pci.h
Expand Up @@ -356,8 +356,11 @@ enum phb_type {
phb_type_npu_v3,
};


/* Generic PCI NVRAM flags */
extern bool verbose_eeh;
extern bool pci_tracing;

void pci_nvram_init(void);

struct phb {
struct dt_node *dt_node;
Expand Down

0 comments on commit 1af237b

Please sign in to comment.