mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
memory: pass MemTxAttrs to memory_access_is_direct()
We want to pass another flag that will be stored in MemTxAttrs. So pass MemTxAttrs directly. Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: David Hildenbrand <david@redhat.com> Link: https://lore.kernel.org/r/20250210084648.33798-6-david@redhat.com [peterx: Fix MacOS builds] Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
d4337aa8e2
commit
d732b5a4ac
6 changed files with 22 additions and 20 deletions
|
@ -573,7 +573,7 @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat,
|
|||
is_write, true, &as, attrs);
|
||||
mr = section.mr;
|
||||
|
||||
if (xen_enabled() && memory_access_is_direct(mr, is_write)) {
|
||||
if (xen_enabled() && memory_access_is_direct(mr, is_write, attrs)) {
|
||||
hwaddr page = ((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr;
|
||||
*plen = MIN(page, *plen);
|
||||
}
|
||||
|
@ -2869,7 +2869,7 @@ static MemTxResult flatview_write_continue_step(MemTxAttrs attrs,
|
|||
return MEMTX_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
if (!memory_access_is_direct(mr, true)) {
|
||||
if (!memory_access_is_direct(mr, true, attrs)) {
|
||||
uint64_t val;
|
||||
MemTxResult result;
|
||||
bool release_lock = prepare_mmio_access(mr);
|
||||
|
@ -2965,7 +2965,7 @@ static MemTxResult flatview_read_continue_step(MemTxAttrs attrs, uint8_t *buf,
|
|||
return MEMTX_ACCESS_ERROR;
|
||||
}
|
||||
|
||||
if (!memory_access_is_direct(mr, false)) {
|
||||
if (!memory_access_is_direct(mr, false, attrs)) {
|
||||
/* I/O case */
|
||||
uint64_t val;
|
||||
MemTxResult result;
|
||||
|
@ -3274,7 +3274,7 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, hwaddr len,
|
|||
while (len > 0) {
|
||||
l = len;
|
||||
mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs);
|
||||
if (!memory_access_is_direct(mr, is_write)) {
|
||||
if (!memory_access_is_direct(mr, is_write, attrs)) {
|
||||
l = memory_access_size(mr, l, addr);
|
||||
if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
|
||||
return false;
|
||||
|
@ -3354,7 +3354,7 @@ void *address_space_map(AddressSpace *as,
|
|||
fv = address_space_to_flatview(as);
|
||||
mr = flatview_translate(fv, addr, &xlat, &l, is_write, attrs);
|
||||
|
||||
if (!memory_access_is_direct(mr, is_write)) {
|
||||
if (!memory_access_is_direct(mr, is_write, attrs)) {
|
||||
size_t used = qatomic_read(&as->bounce_buffer_size);
|
||||
for (;;) {
|
||||
hwaddr alloc = MIN(as->max_bounce_buffer_size - used, l);
|
||||
|
@ -3487,7 +3487,7 @@ int64_t address_space_cache_init(MemoryRegionCache *cache,
|
|||
|
||||
mr = cache->mrs.mr;
|
||||
memory_region_ref(mr);
|
||||
if (memory_access_is_direct(mr, is_write)) {
|
||||
if (memory_access_is_direct(mr, is_write, MEMTXATTRS_UNSPECIFIED)) {
|
||||
/* We don't care about the memory attributes here as we're only
|
||||
* doing this if we found actual RAM, which behaves the same
|
||||
* regardless of attributes; so UNSPECIFIED is fine.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue