[PATCH 3/5] dma: Let ld*_pci_dma() take MemTxAttrs argument

2021-12-18 Thread Philippe Mathieu-Daudé
Let devices specify transaction attributes when calling ld*_pci_dma(). Keep the default MEMTXATTRS_UNSPECIFIED in the few callers. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/pci/pci.h | 6 +++--- hw/audio/intel-hda.c | 2 +- hw/net/eepro100.c| 19 +--

[PATCH 2/5] dma: Let st*_pci_dma() take MemTxAttrs argument

2021-12-18 Thread Philippe Mathieu-Daudé
Let devices specify transaction attributes when calling st*_pci_dma(). Keep the default MEMTXATTRS_UNSPECIFIED in the few callers. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/pci/pci.h | 11 ++- hw/audio/intel-hda.c | 10 ++ hw/net/eepro100.c| 29

[PATCH 5/5] dma: Let ld*_pci_dma() propagate MemTxResult

2021-12-18 Thread Philippe Mathieu-Daudé
ld*_dma() returns a MemTxResult type. Do not discard it, return it to the caller. Update the few callers. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/pci/pci.h | 17 - hw/audio/intel-hda.c | 2 +- hw/net/eepro100.c| 25 ++--- hw/net/tulip.c

[PATCH 4/5] dma: Let st*_pci_dma() propagate MemTxResult

2021-12-18 Thread Philippe Mathieu-Daudé
st*_dma() returns a MemTxResult type. Do not discard it, return it to the caller. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/pci/pci.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index

[PATCH 1/5] hw/scsi/megasas: Use uint32_t for reply queue head/tail values

2021-12-18 Thread Philippe Mathieu-Daudé
While the reply queue values fit in 16-bit, they are accessed as 32-bit: 661:s->reply_queue_head = ldl_le_pci_dma(pcid, s->producer_pa); 662:s->reply_queue_head %= MEGASAS_MAX_FRAMES; 663:s->reply_queue_tail = ldl_le_pci_dma(pcid, s->consumer_pa); 664:s->reply_queue_tail

[PATCH 0/5] hw: Have DMA API take MemTxAttrs arg & propagate MemTxResult (part 4)

2021-12-18 Thread Philippe Mathieu-Daudé
After updating the dma_buf API (part 2) and the ld/st DMA API (part 3), we now update the ld/st PCI DMA API to: - take a MemTxAttrs argument, - propagate a MemTxResult. Based-on: <20211218145111.1540114-1-phi...@redhat.com> "Have DMA API take MemTxAttrs arg & propagate MemTxResult (part 3)"

Re: [PATCH v2] block: drop BLK_PERM_GRAPH_MOD

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
Ping) 03.09.2021 21:47, Eric Blake wrote: On Thu, Sep 02, 2021 at 12:37:54PM +0300, Vladimir Sementsov-Ogievskiy wrote: First, this permission never protected a node from being changed, as generic child-replacing functions don't check it. Second, it's a strange thing: it presents a permission

Re: [RFC PATCH v2 14/14] job.c: enable job lock/unlock and remove Aiocontext locks

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: --- a/block/replication.c +++ b/block/replication.c @@ -728,9 +728,11 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp) * disk, secondary disk in backup_job_completed(). */ if

Re: [RFC PATCH v2 13/14] jobs: add job lock in find_* functions

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
18.12.2021 15:11, Vladimir Sementsov-Ogievskiy wrote: 04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: Both blockdev.c and job-qmp.c have TOC/TOU conditions, because they first search for the job and then perform an action on it. Therefore, we need to do the search + action under the same

Re: [RFC PATCH v2 13/14] jobs: add job lock in find_* functions

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: Both blockdev.c and job-qmp.c have TOC/TOU conditions, because they first search for the job and then perform an action on it. Therefore, we need to do the search + action under the same job mutex critical section. Note: at this stage,

Re: [RFC PATCH v2 11/14] block_job_query: remove atomic read

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: Not sure what the atomic here was supposed to do, since job.busy is protected by the job lock. In block_job_query() it is protected only since previous commit. So, before previous commit, atomic read make sense. Hmm. but job_lock() is still

Re: [RFC PATCH v2 10/14] jobs: protect jobs with job_lock/unlock

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: Introduce the job locking mechanism through the whole job API, following the comments and requirements of job-monitor (assume lock is held) and job-driver (lock is not held). job_{lock/unlock} is independent from_job_{lock/unlock}. Note: at

Re: [RFC PATCH v2 05/14] block/mirror.c: use of job helpers in drivers to avoid TOC/TOU

2021-12-18 Thread Vladimir Sementsov-Ogievskiy
04.11.2021 17:53, Emanuele Giuseppe Esposito wrote: Once job lock is used and aiocontext is removed, mirror has to perform job operations under the same critical section, using the helpers prepared in previous commit. Note: at this stage, job_{lock/unlock} and job lock guard macros are *nop*.

[PATCH v2] hw/scsi/megasas: Simplify using the ldst API

2021-12-18 Thread Philippe Mathieu-Daudé
This code is easier to review using the load/store API. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- v2: Fixed offset in megasas_setup_inquiry (rth) --- hw/scsi/megasas.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git

Re: [PATCH] hw/scsi/megasas: Simplify using the ldst API

2021-12-18 Thread Philippe Mathieu-Daudé
On 12/18/21 01:36, Richard Henderson wrote: > On 12/17/21 3:15 PM, Philippe Mathieu-Daudé wrote: >> -    cdb[3] = (len >> 8) & 0xff; >> -    cdb[4] = (len & 0xff); >> +    stw_be_p([2], len); > > Wrong offset.  Otherwise, >_< > Reviewed-by: Richard Henderson Thank you.