Mailing List Archive

[PATCH] flask: label-pci: Allow specifying irq label
IRQs can be shared, so uniquely labeling doesn't always work. You run
into issues if you have domA_t allowed access to device_A_t and domB_t
to device_B_t. The shared IRQ can only be labeled one of
device_A_t or device_B_t, and assignment of the second device fails
since domA_t doesn't have permission for device_B_t and vice versa.

Add the ability to specify an irq label to flask-label-pci. A
shared_irq_t can then be used to for the PIRQ. The default remains to
use the device label if an IRQ label isn't specified.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
tools/flask/utils/label-pci.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/flask/utils/label-pci.c b/tools/flask/utils/label-pci.c
index 9ddb713cf4..897b772804 100644
--- a/tools/flask/utils/label-pci.c
+++ b/tools/flask/utils/label-pci.c
@@ -28,7 +28,7 @@

static void usage (int argCnt, char *argv[])
{
- fprintf(stderr, "Usage: %s SBDF label\n", argv[0]);
+ fprintf(stderr, "Usage: %s SBDF label <irq_label>\n", argv[0]);
exit(1);
}

@@ -39,12 +39,19 @@ int main (int argCnt, char *argv[])
int seg, bus, dev, fn;
uint32_t sbdf;
uint64_t start, end, flags;
+ char *pirq_label;
char buf[1024];
FILE *f;

- if (argCnt != 3)
+ if (argCnt < 3 || argCnt > 4)
usage(argCnt, argv);

+ if (argCnt == 4) {
+ pirq_label = argv[3];
+ } else {
+ pirq_label = argv[2];
+ }
+
xch = xc_interface_open(0,0,0);
if ( !xch )
{
@@ -107,7 +114,7 @@ int main (int argCnt, char *argv[])
if (fscanf(f, "%" SCNu64, &start) != 1)
start = 0;
if (start) {
- ret = xc_flask_add_pirq(xch, start, argv[2]);
+ ret = xc_flask_add_pirq(xch, start, pirq_label);
if (ret) {
fprintf(stderr, "xc_flask_add_pirq %"PRIu64" failed: %d\n",
start, ret);
--
2.26.2