* [PATCH] flask: label-pci: Allow specifying irq label
@ 2020-10-19 20:03 Jason Andryuk
2021-01-20 19:13 ` Jason Andryuk
2021-01-21 1:32 ` dpsmith.dev
0 siblings, 2 replies; 3+ messages in thread
From: Jason Andryuk @ 2020-10-19 20:03 UTC (permalink / raw)
To: xen-devel; +Cc: Jason Andryuk, Daniel De Graaf, Ian Jackson, Wei Liu
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] flask: label-pci: Allow specifying irq label
2020-10-19 20:03 [PATCH] flask: label-pci: Allow specifying irq label Jason Andryuk
@ 2021-01-20 19:13 ` Jason Andryuk
2021-01-21 1:32 ` dpsmith.dev
1 sibling, 0 replies; 3+ messages in thread
From: Jason Andryuk @ 2021-01-20 19:13 UTC (permalink / raw)
To: xen-devel; +Cc: Daniel De Graaf, Ian Jackson, Wei Liu
On Mon, Oct 19, 2020 at 4:03 PM Jason Andryuk <jandryuk@gmail.com> wrote:
>
> 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>
> ---
Hi,
This is useful to me and was posted before the 4.15 cut off. Can it
make it into the release?
Thanks,
Jason
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] flask: label-pci: Allow specifying irq label
2020-10-19 20:03 [PATCH] flask: label-pci: Allow specifying irq label Jason Andryuk
2021-01-20 19:13 ` Jason Andryuk
@ 2021-01-21 1:32 ` dpsmith.dev
1 sibling, 0 replies; 3+ messages in thread
From: dpsmith.dev @ 2021-01-21 1:32 UTC (permalink / raw)
To: Jason Andryuk, xen-devel; +Cc: Daniel De Graaf, Ian Jackson, Wei Liu
On 10/19/20 4:03 PM, Jason Andryuk wrote:
> 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>
I don't think it should block this from going in but it probably would
be good to get an update into docs/misc/xsm-flask.txt on how to
appropriately use this expansion.
Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
v/r,
dps
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-21 1:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 20:03 [PATCH] flask: label-pci: Allow specifying irq label Jason Andryuk
2021-01-20 19:13 ` Jason Andryuk
2021-01-21 1:32 ` dpsmith.dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).