|
| From: | Richard Henderson |
| Subject: | Re: [PATCH v5 01/20] hw: encode accessing CPU index in MemTxAttrs |
| Date: | Sat, 12 Nov 2022 14:18:50 +1000 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
On 11/12/22 04:25, Alex Bennée wrote:
+/*
+ * Bus masters which don't specify any attributes will get this which
+ * indicates none of the attributes can be used.
+ */
+#define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) \
+ { .requester_type = MTRT_UNSPECIFIED })
+
+/*
+ * Helper for setting a basic CPU sourced transaction, it expects a
+ * CPUState *
+ */
+#define MEMTXATTRS_CPU(cs) ((MemTxAttrs) \
+ {.requester_type = MTRT_CPU, \
+ .requester_id = cs->cpu_index})
+
+/*
+ * Helper for setting a basic PCI sourced transaction, it expects a
+ * PCIDevice *
*/
+#define MEMTXATTRS_PCI(dev) ((MemTxAttrs) \
+ {.requester_type = MTRT_PCI, \
+ .requester_id = pci_requester_id(dev)})
Any reason these second two shouldn't be inlines?Anything with arguments gets better type checking that way, unless you need preprocessor magic, which is not the case here.
Otherwise, Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
| [Prev in Thread] | Current Thread | [Next in Thread] |