DM: mmio dev: allocate GPA resource for mmio device

The mmio devices use hard code GPA base, allocating GPA base resource
for them instead.

Tracked-On: #5913
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Tao Yuhong 2021-04-19 09:56:20 -04:00 committed by wenlingz
parent 63dd23bc9e
commit 12f5a78800

View File

@ -110,12 +110,19 @@ static struct mmio_dev_ops *mmio_dev_finddev(char *name)
int init_mmio_dev(struct vmctx *ctx, struct mmio_dev_ops *ops)
{
int ret;
uint32_t base;
struct acrn_mmiodev mmiodev = {
.base_gpa = ops->base_gpa,
.base_hpa = ops->base_hpa,
.size = ops->size,
};
ret = mmio_dev_alloc_gpa_resource32(&base, ops->size);
if (ret < 0)
return ret;
mmiodev.base_gpa = base;
ops->base_gpa = base;
return ops->init(ctx, &mmiodev);
}
@ -184,7 +191,6 @@ struct mmio_dev_ops tpm2 = {
/* ToDo: we may allocate the gpa MMIO resource in a reserved MMIO region
* rether than hard-coded here.
*/
.base_gpa = 0xFED40000UL,
.base_hpa = 0xFED40000UL,
.size = 0x00005000UL,
.init = init_pt_mmiodev,
@ -202,7 +208,6 @@ struct mmio_dev_ops pt_mmiodev = {
/* ToDo: we may allocate the gpa MMIO resource in a reserved MMIO region
* rether than hard-coded here.
*/
.base_gpa = 0xF0000000UL,
.init = init_pt_mmiodev,
.deinit = deinit_pt_mmiodev,
};