All of lore.kernel.org
 help / color / mirror / Atom feed
* DCD region base address
@ 2023-07-20  1:43 Shesha Bhushan Sreenivasamurthy
  2023-07-24  9:03 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Shesha Bhushan Sreenivasamurthy @ 2023-07-20  1:43 UTC (permalink / raw)
  To: linux-cxl@vger.kernel.org

Hello All,

I am adding FM-API support to add DCD extents in QEMU. The current code is not making sense to me.  According to CXL3.0 spec (Table 8-126), region_base should be the DPA and not the size, decode_length is the total region length which is used to program HDM decoders, region_len is the usable length meaning as extents are added the region_len increases up to a max of decode_length. So should be 0 before we add any extents. 

This is what it should look like in my opinion. Am I correct ?

--- hw/mem/cxl_type3_old.c    2023-07-19 18:18:54.211748475 -0700
+++ hw/mem/cxl_type3.c  2023-07-19 18:27:13.468602825 -0700
@@ -747,10 +747,10 @@
 static int cxl_create_toy_regions(CXLType3Dev *ct3d)
 {
      int i;
-     uint64_t region_base = ct3d->hostvmem?ct3d->hostvmem->size
-           :ct3d->hostpmem->size;
-     uint64_t region_len = 1024*1024*1024;
-     uint64_t decode_len = 4; /* 4*256MB */
+    MemoryRegion *mr = host_memory_backend_get_memory(ct3d->dc.host_dc);
+    uint64_t region_base = (uint64_t)memory_region_get_ram_ptr(mr);
+     uint64_t region_len = 0;
+     uint64_t decode_len = ct3d->dc.host_dc->size / ct3d->dc.num_regions / (256*1024*1024);
      uint64_t blk_size = 2*1024*1024;
      struct CXLDCD_Region *region;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-24 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-20  1:43 DCD region base address Shesha Bhushan Sreenivasamurthy
2023-07-24  9:03 ` Jonathan Cameron
2023-07-24 17:10   ` Fan Ni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.