Re: [kvm-unit-tests PATCH 08/11] arm/pci: PCI device read/write test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 09, 2016 at 01:22:55PM +0100, Alexander Gordeev wrote:
> Cc: Andrew Jones <drjones@xxxxxxxxxx>
> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> ---
>  lib/pci-testdev.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/lib/pci-testdev.c b/lib/pci-testdev.c
> index de97f82..dd6a5ac 100644
> --- a/lib/pci-testdev.c
> +++ b/lib/pci-testdev.c
> @@ -113,6 +113,9 @@ static bool pci_testdev_one(struct pci_test_dev_hdr *test,
>  			    struct pci_testdev_ops *ops)
>  {
>  	u8 width;
> +	u32 sig, off;
> +	const int nr_writes = 16;
> +	int i;
>  
>  	ops->write8(test_nr, &test->test);
>  	assert(ops->read32(&test->count) == 0);
> @@ -121,6 +124,19 @@ static bool pci_testdev_one(struct pci_test_dev_hdr *test,
>  	if ((width != 1) && (width != 2) && (width != 4))
>  		return false;
>  
> +	sig = ops->read32(&test->data);
> +	off = ops->read32(&test->offset);
> +
> +	for (i = 0; i < nr_writes; i++) {
> +		switch (width) {
> +			case 1: ops->write8 (sig, (void*)test + off); break;
> +			case 2: ops->write16(sig, (void*)test + off); break;
> +			case 4: ops->write32(sig, (void*)test + off); break;
> +		}
> +	}
> +
> +	assert((int)ops->read32(&test->count) == nr_writes);

Are you sure we want to assert here? What about outputting a message and
then returning false instead?

> +
>  	return true;
>  }
>  
> -- 
> 1.8.3.1
> 
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux