From: Andrew Cooper Date: Thu, 27 Dec 2018 18:40:19 +0000 (+0000) Subject: docs: Improve documentation and parsing for pci= X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=01397478f29239a0e22655ff1a35f4ff9577b63b;p=people%2Fpauldu%2Fxen.git docs: Improve documentation and parsing for pci= Alter parse_pci_param() to use parse_boolean(), so the sub options behave like other Xen booleans. Update the command line documentation for consistency. Signed-off-by: Andrew Cooper Reviewed-by: Roger Pau Monné Reviewed-by: Jan Beulich Release-acked-by: Juergen Gross --- diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc index 0d4268d1ff..7aaf922265 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1500,13 +1500,12 @@ This option is ignored in **pv-shim** mode. > Default: `on` ### pci -> `= {no-}serr | {no-}perr` + = List of [ serr=, perr= ] -> Default: Signaling left as set by firmware. - -Disable signaling of SERR (system errors) and/or PERR (parity errors) -on all PCI devices. + Default: Signaling left as set by firmware. +Override the firmware settings, and explicitly enable or disable the +signalling of PCI System and Parity errors. ### pci-phantom > `=[:]:,` diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index 93c20b9b06..8108ed5f9a 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -188,37 +188,25 @@ custom_param("pci-phantom", parse_phantom_dev); static u16 __read_mostly command_mask; static u16 __read_mostly bridge_ctl_mask; -/* - * The 'pci' parameter controls certain PCI device aspects. - * Optional comma separated value may contain: - * - * serr don't suppress system errors (default) - * no-serr suppress system errors - * perr don't suppress parity errors (default) - * no-perr suppress parity errors - */ static int __init parse_pci_param(const char *s) { const char *ss; int rc = 0; do { - bool_t on = !!strncmp(s, "no-", 3); + int val; u16 cmd_mask = 0, brctl_mask = 0; - if ( !on ) - s += 3; - ss = strchr(s, ','); if ( !ss ) ss = strchr(s, '\0'); - if ( !cmdline_strcmp(s, "serr") ) + if ( (val = parse_boolean("serr", s, ss)) >= 0 ) { cmd_mask = PCI_COMMAND_SERR; brctl_mask = PCI_BRIDGE_CTL_SERR | PCI_BRIDGE_CTL_DTMR_SERR; } - else if ( !cmdline_strcmp(s, "perr") ) + else if ( (val = parse_boolean("perr", s, ss)) >= 0 ) { cmd_mask = PCI_COMMAND_PARITY; brctl_mask = PCI_BRIDGE_CTL_PARITY; @@ -226,7 +214,7 @@ static int __init parse_pci_param(const char *s) else rc = -EINVAL; - if ( on ) + if ( val ) { command_mask &= ~cmd_mask; bridge_ctl_mask &= ~brctl_mask;