Am 2018-10-31 11:19, schrieb Paolo Bonzini:
On 18/07/2018 12:48, Michael Walle wrote:
/**
+ * get_irq_latched:
+ * @num: Interrupt to observe.
+ *
+ * Returns: The latched level of the @num interrupt.
+ */
+static inline bool get_irq_latched(int num)
+{
+ return qtest_get_irq_latched(global_qtest, num);
+}
+
+/**
+ * clear_irq_latch:
+ * @num: Interrupt to operate on.
+ *
+ * Clears the latch of the @num interrupt.
+ */
+static inline void clear_irq_latch(int num)
+{
+ return qtest_clear_irq_latch(global_qtest, num);
+}
+
+/**
* irq_intercept_in:
* @string: QOM path of a device.
*
Just one thing, I think an atomic test-and-clear is a better API. I
understand that what you have works, because
get_irq_latched+clear_irq_latch don't have any intervening access to
the
qtest socket.
Ok thanks, like get_and_clear_irq_latched()? Do you think of we still
need the get_irq_latched() to get the state without actually clearing
it? I mean my simple test case won't need it, but there might be some
cases where you may want peek at the state.
-michael