[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 04/10] rust: pl011: extract CharBackend receive logic into a
From: |
Zhao Liu |
Subject: |
Re: [PATCH 04/10] rust: pl011: extract CharBackend receive logic into a separate function |
Date: |
Wed, 22 Jan 2025 22:59:07 +0800 |
On Fri, Jan 17, 2025 at 10:26:51AM +0100, Paolo Bonzini wrote:
> Date: Fri, 17 Jan 2025 10:26:51 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 04/10] rust: pl011: extract CharBackend receive logic into
> a separate function
> X-Mailer: git-send-email 2.47.1
>
> Prepare for moving all references to the registers and the FIFO into a
> separate struct.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/hw/char/pl011/src/device.rs | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
[snip]
> - pub fn put_fifo(&mut self, value: c_uint) {
> + pub fn put_fifo(&mut self, value: u32) {
> let depth = self.fifo_depth();
> assert!(depth > 0);
> let slot = (self.read_pos + self.read_count) & (depth - 1);
> @@ -615,12 +621,9 @@ pub fn write(&mut self, offset: hwaddr, value: u64) {
> unsafe {
> debug_assert!(!opaque.is_null());
> let mut state = NonNull::new_unchecked(opaque.cast::<PL011State>());
> - if state.as_ref().loopback_enabled() {
> - return;
> - }
> if size > 0 {
> debug_assert!(!buf.is_null());
> - state.as_mut().put_fifo(c_uint::from(buf.read_volatile()))
An extra question...here I'm not sure, do we really need read_volatile?
> + state.as_mut().receive(u32::from(buf.read_volatile()));
> }
> }
> }
Patch is fine for me,
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
- [PATCH 00/10] rust: pl011: correctly use interior mutability, Paolo Bonzini, 2025/01/17
- [PATCH 04/10] rust: pl011: extract CharBackend receive logic into a separate function, Paolo Bonzini, 2025/01/17
- Re: [PATCH 04/10] rust: pl011: extract CharBackend receive logic into a separate function,
Zhao Liu <=
- [PATCH 06/10] rust: pl011: extract PL011Registers, Paolo Bonzini, 2025/01/17
- [PATCH 05/10] rust: pl011: pull interrupt updates out of read/write ops, Paolo Bonzini, 2025/01/17
- [PATCH 07/10] rust: pl011: wrap registers with BqlRefCell, Paolo Bonzini, 2025/01/17