[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq5ay0osd9yb.fsf@kernel.org>
Date: Thu, 30 Oct 2025 14:48:20 +0530
From: Aneesh Kumar K.V <aneesh.kumar@...nel.org>
To: Jonathan Cameron <jonathan.cameron@...wei.com>
Cc: linux-coco@...ts.linux.dev, kvmarm@...ts.linux.dev,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	dan.j.williams@...el.com, aik@....com, lukas@...ner.de,
	Samuel Ortiz <sameo@...osinc.com>,
	Xu Yilun <yilun.xu@...ux.intel.com>,
	Jason Gunthorpe <jgg@...pe.ca>,
	Suzuki K Poulose <Suzuki.Poulose@....com>,
	Steven Price <steven.price@....com>,
	Bjorn Helgaas <helgaas@...nel.org>,
	Catalin Marinas <catalin.marinas@....com>,
	Marc Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>
Subject: Re: [PATCH RESEND v2 06/12] coco: host: arm64: Add RMM device
 communication helpers
Jonathan Cameron <jonathan.cameron@...wei.com> writes:
...
>> +		/*
>> +		 * Some device communication error will transition the
>> +		 * device to error state. Report that.
>> +		 */
>> +		if (type == PDEV_COMMUNICATE)
>> +			ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
>> +						 (enum rmi_pdev_state *)&state);
>> +		if (ret)
>> +			state = error_state;
> Whilst not strictly needed I'd do this as:
>
> 		if (type == PDEV_COMMUNICATE) {
> 			ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
> 						 (enum rmi_pdev_state *)&state);
> 			if (ret)
> 				state = error_state;
> 		}
>
> Just to make it clear that reg check is just on the output of the call above.
> If we didn't make that call it is definitely zero but nice not to have
> to reason about it.
>
Some of this is because follow up patch adds more details there. In this case.
		/*
		 * Some device communication error will transition the
		 * device to error state. Report that.
		 */
		if (type == PDEV_COMMUNICATE)
			ret = rmi_pdev_get_state(virt_to_phys(pf0_dsc->rmm_pdev),
						 (enum rmi_pdev_state *)&state);
		else
			ret = rmi_vdev_get_state(virt_to_phys(host_tdi->rmm_vdev),
						 (enum rmi_vdev_state *)&state);
		if (ret)
			state = error_state;
>
>> +	}
>> +
>> +	if (state == error_state)
>> +		pci_err(tsm->pdev, "device communication error\n");
>> +
>> +	return state;
>> +}
>> +
-aneesh
Powered by blists - more mailing lists
 
