Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS/DriverKit through MacVFN #10

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
abab907
mmio: convert calls of 'addr + offset' to 'base-addr, offset'
Baekalfen Aug 20, 2023
1982a33
support/linux: move linux mem.c to src/support/platform/linux/
Baekalfen Sep 12, 2023
37b5cbf
support/linux: prepartory work of moving log, mem, mmio, mutex header…
Baekalfen Sep 13, 2023
3f8f21e
support/macos: add macos replacement for byteswap.h
Baekalfen Sep 13, 2023
cedbf40
support/macos: add macos replacement for errno.h
Baekalfen Sep 13, 2023
c698007
support/macos: added include/.../platform/macos/log.h
Baekalfen Sep 13, 2023
b09b63c
support/macos: added include/.../platform/macos/mem.h
Baekalfen Sep 13, 2023
0e640ea
support/macos: added include/.../platform/macos/mmio.h
Baekalfen Sep 13, 2023
6a75519
support/macos: added include/.../platform/macos/mutex.h
Baekalfen Sep 13, 2023
b7fbecc
misc/cpp: add explicit cast of void* and change string concat to acco…
Baekalfen Sep 13, 2023
d81e69f
gitignore: crc64table.h and config.h
Baekalfen Sep 13, 2023
ff1b9e6
src/iommu/context.h: Add include guard
Baekalfen Apr 11, 2024
91b3142
misc: reduce includes, add C++ ifdef
Baekalfen Apr 9, 2024
da24e66
iommu/iova: dma_map, iova_map_add, dma_unmap takes iova_mapping
Baekalfen Apr 9, 2024
45be927
skiplist: replace rand() with arc4random() as it's not present on macOS
Baekalfen Apr 10, 2024
a961d1a
skiplist: Add include guard
Baekalfen Apr 10, 2024
290dcd4
nvme_wait_rdy: timeout for macOS
Baekalfen Apr 11, 2024
3b4bae1
nvme_cq_wait_cqes: timeout for macOS and counting ticks
Baekalfen Apr 11, 2024
1c48f71
nvme/core: add serial to nvme_ctrl
Baekalfen Apr 30, 2024
87ba60d
pgmap/iommu: refactor for opaque pointers
Baekalfen May 3, 2024
3b111dd
macos: DriverKit core backend
Baekalfen Sep 13, 2023
e2144c2
misc/log: change logging on unrecoverable errors
Baekalfen May 3, 2024
934f841
ci/macos: add macOS build process
Baekalfen May 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nvme/core: add serial to nvme_ctrl
Added serial string to nvme_ctrl to be able to identify the device. This
value is copied from the already issued identify during nvme_init.

Signed-off-by: Mads Ynddal <m.ynddal@samsung.com>
Baekalfen committed May 24, 2024
commit 1c48f71fa5e9eb34e3f21b73f7a0df5990e495b5
5 changes: 5 additions & 0 deletions include/vfn/nvme/ctrl.h
Original file line number Diff line number Diff line change
@@ -45,6 +45,11 @@ struct nvme_ctrl {
*/
struct vfio_pci_device pci;

/**
* @serial: Serial number from controller
*/
char serial[20];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bloats struct nvme_ctrl and it does not seem to be used in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had put something in the commit message. It's for enumeration in xNVMe. MacVFN reads this serial and applies it to its name in macOS's "IO registry" of devices.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but it belongs in MacVFN then.


/**
* @regs: Controller Configuration (``MBAR.CC``) registers
*/
2 changes: 2 additions & 0 deletions src/nvme/core.c
Original file line number Diff line number Diff line change
@@ -617,6 +617,8 @@ int nvme_init(struct nvme_ctrl *ctrl, const char *bdf, const struct nvme_ctrl_op
goto out;
}

memcpy(ctrl->serial, ((char *) vaddr) +
NVME_IDENTIFY_CTRL_SERIAL_NUMBER, sizeof(ctrl->serial));
oacs = le16_to_cpu(*(leint16_t *)(((uintptr_t) vaddr) + NVME_IDENTIFY_CTRL_OACS));

if (oacs & NVME_IDENTIFY_CTRL_OACS_DBCONFIG)
3 changes: 2 additions & 1 deletion src/nvme/types.h
Original file line number Diff line number Diff line change
@@ -102,7 +102,8 @@ enum nvme_identify_cns {
};

enum nvme_identify_ctrl_offset {
NVME_IDENTIFY_CTRL_OACS = 0x100,
NVME_IDENTIFY_CTRL_SERIAL_NUMBER = 0x4,
NVME_IDENTIFY_CTRL_OACS = 0x100,
};

enum nvme_identify_ctrl_oacs {