ns16550: MMIO r/o ranges are maintained at page granularity
authorJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 07:36:59 +0000 (09:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 07:36:59 +0000 (09:36 +0200)
commit82de0a6facf8e4699958654bcbef974e33480ed7
tree3050c2a5c42998530e691d3c501cdc3f83828dec
parent0c229e6c9fb1fef776a423dfcbbbe6b67122d7a6
ns16550: MMIO r/o ranges are maintained at page granularity

Passing byte granular values will not have the intended effect. Address
the immediate issue, but I don't think what we do is actually
sufficient: At least some devices allow access to their registers via
either I/O ports or MMIO. In such aliasing cases we'd need to protect
the MMIO range even when we use I/O port accesses to drive the port.

Note that this way we may write-protect MMIO ranges of unrelated devices
as well. To deal with this, faults resulting from this would need
handling, to emulate the accesses outside of the protected range. (An
alternative would be to relocate the BAR, but I'm afraid this might end
up even more challenging.)

Fixes: c9f8e0aee507 ("ns16550: Add support for UART present in Broadcom TruManage capable NetXtreme chips")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/drivers/char/ns16550.c