Thread (32 messages) 32 messages, 7 authors, 2021-02-23

Re: [PATCH v2 02/11] hw/boards: Introduce machine_class_valid_for_accelerator()

From: Cornelia Huck <cohuck@redhat.com>
Date: 2021-02-22 18:02:24
Also in: qemu-arm, qemu-devel, xen-devel

On Mon, 22 Feb 2021 18:46:15 +0100
Philippe Mathieu-Daudé [off-list ref] wrote:
On 2/22/21 6:34 PM, Cornelia Huck wrote:
quoted
On Fri, 19 Feb 2021 18:38:38 +0100
Philippe Mathieu-Daudé [off-list ref] wrote:
  
quoted
Introduce the valid_accelerators[] field to express the list
of valid accelators a machine can use, and add the
machine_class_valid_for_current_accelerator() and
machine_class_valid_for_accelerator() methods.

Signed-off-by: Philippe Mathieu-Daudé <redacted>
---
 include/hw/boards.h | 24 ++++++++++++++++++++++++
 hw/core/machine.c   | 26 ++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 68d3d10f6b0..4d08bc12093 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -36,6 +36,24 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                const CpuInstanceProperties *props,
                                Error **errp);
 
+/**
+ * machine_class_valid_for_accelerator:
+ * @mc: the machine class
+ * @acc_name: accelerator name
+ *
+ * Returns %true if the accelerator is valid for the machine, %false
+ * otherwise. See #MachineClass.valid_accelerators.  
Naming confusion: is the machine class valid for the accelerator, or
the accelerator valid for the machine class? Or either? :)  
"the accelerator valid for the machine class".

Is this clearer?

"Returns %true if the current accelerator is valid for the
 selected machine, %false otherwise.

Or...

"Returns %true if the selected accelerator is valid for the
 current machine, %false otherwise.
Maybe that one, given how it ends up being called? Or "specified
machine"?
How would look "either"?

The machine is already selected, and the accelerator too...
Yes, so this is basically testing the (machine,accelerator) tuple,
which is what I meant with 'either'.
quoted
  
quoted
+ */
+bool machine_class_valid_for_accelerator(MachineClass *mc, const char *acc_name);
+/**
+ * machine_class_valid_for_current_accelerator:
+ * @mc: the machine class
+ *
+ * Returns %true if the accelerator is valid for the current machine,
+ * %false otherwise. See #MachineClass.valid_accelerators.  
Same here: current accelerator vs. current machine.
So maybe

"Returns %true if the current accelerator is valid for the specified
machine class..." ?
quoted
  
quoted
+ */
+bool machine_class_valid_for_current_accelerator(MachineClass *mc);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help