Re: [RFC PATCH v1 38/38] coco: guest: arm64: Add support for fetching device info

Jonathan Cameron
2025-08-04T10:23:41Z

> >
> >> + if (!dev_info) {
> >> + ret = -ENOMEM;
> >> + goto err_out;
> >> + }
> >> +
> >> + ret = rsi_rdev_get_info(vdev_id, dsm->instance_id, virt_to_phys(dev_info));
> >> + if (ret != RSI_SUCCESS) {
> >> + pci_err(pdev, "failed to get device digests (%lu)\n", ret);
> >> + ret = -EIO;
> >> + kfree(dev_info);
> >> + goto err_out;
> >> + }
> >> +
> >> + dsm->dev_info.attest_type = dev_info->attest_type;
> >> + dsm->dev_info.cert_id = dev_info->cert_id;
> >> + dsm->dev_info.hash_algo = dev_info->hash_algo;
> >> + memcpy(dsm->dev_info.cert_digest, dev_info->cert_digest, SHA512_DIGEST_SIZE);
> >> + memcpy(dsm->dev_info.meas_digest, dev_info->meas_digest, SHA512_DIGEST_SIZE);
> >> + memcpy(dsm->dev_info.report_digest, dev_info->report_digest, SHA512_DIGEST_SIZE);
> >> +
> >
> > Can't you memcpy the whole thing in one go?
> >
>
> yes. But won't that be confusing? Is there a difference?
> Also struct dsm_device_info is not same as struct rsi_device_info. We
> don't need to keep all that padding in dsm_device_info.
Ah. I misread and thought they were the same structure. No problem copying
only relevant fields then!

Jonathan