CN116204933B - 一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 - Google Patents
一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 Download PDFInfo
- Publication number
- CN116204933B CN116204933B CN202310492989.1A CN202310492989A CN116204933B CN 116204933 B CN116204933 B CN 116204933B CN 202310492989 A CN202310492989 A CN 202310492989A CN 116204933 B CN116204933 B CN 116204933B
- Authority
- CN
- China
- Prior art keywords
- jailhouse
- gic
- root cell
- mem
- pcie
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
- G06F21/71—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
- G06F21/74—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information operating in dual or compartmented mode, i.e. at least one secure mode
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明提供一种ARM64架构下基于jailhouse隔离PCIe网卡的方法,删除主机使用的设备树文件中的gic‑its节点和PCIe节点;将gic‑its节点和PCIe节点添加至jailhouse non root cell的设备树文件中;通过设备树文件中的inteerupt‑controller节点中的reg属性,获取gic redistributor的内存地址和内存大小;将gic redistributor的内存地址和内存大小添加到root cell和non root cell的配置文件中;运行jailhouse,non root cell中的guest os正常使用PCIe网卡。
Description
技术领域
本发明涉及一种计算机PCIe网卡隔离,尤其涉及一种ARM64架构下基于jailhouse隔离PCIe网卡的方法。
背景技术
Jailhouse是一个针对创建工业级应用程序的小型Hypervisor,Jailhouse在现有Linux之上启用非对称多处理方式,并将系统拆分成称为cell的独立分区。主机首先运行的是root cell,加载host os,新的cell为non root cell,加载的是guest os,每个 cell 运行一个OS 并拥有一组完全控制的分配资源(CPU、内存区域、PCI设备)。
但是当前开源的jailhouse程序在ARM64架构的机器上还没有实现物理PCIe设备的隔离,例如无法将一个PCIe网卡隔离给guest os使用。
因此如何提供一种在ARM64架构下将物理PCIe网卡隔离给guest os的方法是本领域技术人员亟需解决的问题。
发明内容
针对上述问题,本发明提供一种ARM64架构下基于jailhouse隔离PCIe网卡的方法;通过修改主机的设备树,去掉设备树中的gic-its节点、PCIe节点,并将这两个节点添加到jailhouse的non root cell的设备树文件中,则non root cell中的guest os可以拥有完整的gic-its设备和PCIe主桥设备,从而PCIe网卡也被隔离到guest os中;然后将gicredistributor的内存地址和内存大小分别添加到root cell和non root cell的配置文件中,则non root cell运行的guest os可以访问gic中的redistributor硬件,这样non rootcell中的guest os可以正确配置PCIe网卡的IP地址,正常上网。
为实现上述目的,本发明公开了一种ARM64架构下基于jailhouse隔离PCIe网卡的方法,包括以下步骤:
S1、删除主机使用的设备树文件中的gic-its节点和PCIe节点;
S2、将S1中的gic-its节点和PCIe节点添加至jailhouse non root cell的设备树文件中;
S3、通过主机使用的设备树文件中的inteerupt-controller节点中的reg属性,获取gic redistributor的内存地址和内存大小;
S4、将gic redistributor的内存地址和内存大小添加到root cell和non rootcell的配置文件中;
S5、运行jailhouse,non root cell中的guest os正常使用PCIe网卡。
进一步的,所述S1具体为:删除主机使用的设备树文件ft2004-devboard.dts中的gic-its节点和PCIe节点,从而将中断翻译服务和PCIe网卡设备从主机中移除。
进一步的,所述S3具体为:通过主机使用的设备树ft2004-devboard.dts,获取interrupt-controller节点中的reg属性,从而获取reg属性中的第六个元素的值0x29980000,第八个元素的值0x80000,其分别表示gic redistributor的内存地址和内存大小。
进一步的,所述步骤S4具体为:
修改root cell的配置文件main.c,在mem_regions数组中添加如下内容,使得jailhouse root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO
};
修改non root cell的配置文件inmate.c,在mem_regions数组中添加如下内容,使得jailhouse non root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO|JAILHOUSE_MEM_ROOTSHARED
}。
本发明的一种ARM64架构下基于jailhouse隔离PCIe网卡的方法的有益效果为:gic redistributor的内存地址和内存大小分别添加到root cell和non root cell的配置文件中,则non root cell运行的guest os可以访问gic中的redistributor硬件,这样nonroot cell中的guest os可以正确配置PCIe网卡的IP地址,正常上网,从而实现一种在ARM64架构下将物理PCIe网卡隔离给guest os。
附图说明
下面结合附图和具体实施方式对本发明作进一步详细的说明。
图1是本发明的隔离PCIe网卡的整体流程示意图。
具体实施方式
下面结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是本发明还可以采用其他不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本发明内涵的情况下做类似推广,因此本发明不受下面公开的具体实施例的限制。
本申请的实施例公开了一种ARM64架构下基于jailhouse隔离PCIe网卡的方法,包括以下步骤:
S1、删除主机使用的设备树文件中的gic-its节点和PCIe节点;
S2、将S1中的gic-its节点和PCIe节点添加至jailhouse non root cell的设备树文件中;
S3、通过主机使用的设备树文件中的inteerupt-controller节点中的reg属性,获取gic redistributor的内存地址和内存大小;
S4、将gic redistributor的内存地址和内存大小添加到root cell和non rootcell的配置文件中;
S5、运行jailhouse,non root cell中的guest os正常使用PCIe网卡。
为进一步优化上述技术方案,S1具体为:删除主机使用的设备树文件ft2004-devboard.dts中的gic-its节点和PCIe节点,从而将中断翻译服务和PCIe网卡设备从主机中移除。
为进一步优化上述技术方案,S3具体为:通过主机使用的设备树ft2004-devboard.dts,获取interrupt-controller节点中的reg属性,从而获取reg属性中的第六个元素的值0x29980000,第八个元素的值0x80000,其分别表示gic redistributor的内存地址和内存大小。
为进一步优化上述技术方案,步骤S4具体为:
修改root cell的配置文件main.c,在mem_regions数组中添加如下内容,使得jailhouse root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO
};
修改non root cell的配置文件inmate.c,在mem_regions数组中添加如下内容,使得jailhouse non root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO|JAILHOUSE_MEM_ROOTSHARED
}。
准备一台ft2004开发板,安装CentOS8.1系统,安装Jailhosue代码,并准备开发板主机启动时所用的设备树文件ft2004-devboard.dts,测试jailhouse时启动root cell的配置文件main.c, 启动non root cell所需的配置文件inmate.c,设备树文件inmate-ama.dts,文件系统文件rootfs.cpio,内核镜像文件Image。
图1所示为本申请的隔离PCIe网卡的整体流程示意图,包括:
a.修改开发板主机和jailhouse启动non root cell时的设备树文件
a1.在开发板主机启动时所用的设备树文件ft2004-devboard.dts中删掉gic-its节点、PCIe节点内容,从而将中断翻译服务(its,interrupt translation service)从主机中移除,以供jailhouse的non root cel使用,并使得PCIe设备在主机中移除,以供jailhouse的non root cell使用。
a2.将a1步骤中gic-its节点、PCIe节点内容添加到non root cell的设备树文件inmate-ama.dts中,则jailhouse的non root cell含有its硬件,及PCIe网卡设备可用。
b.修改jailhouse的配置文件,添加jailhouse对中断控制器(gic,generateinterrupt controller)的访问
b1.查看开发板主机启动时所用的设备树文件ft2004-devboard.dts,找到interrupt-controller节点中的reg属性,查看该属性中的第六个元素的值为0x29980000,第八个元素的值为0x80000,其分别表示gic redistributor的内存地址和内存大小。
b2.修改root cell的配置文件main.c,在mem_regions数组中添加下面内容,使得jailhouse root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO
};
b3.修改non root cell的配置文件inmate.c,在mem_regions数组中添加下面内容,使得jailhouse non root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO|JAILHOUSE_MEM_ROOTSHARED
};
编译安装代码,加载驱动之后,验证方法如下:
a.启动hypervisor及root cell:jailhouse enable main.cell串口最后输出下面信息,表示hypervisor正常启动:
Activating hypervisor
b.使用以下命令启动non root cell:
jailhouse cell inmate.cell Image -d inmate-ama.dtb -i rootfs.cpio -c"earlycon=PL011,0x28000000 console=ttyAMA0,115200 root=/dev/ram0 ramdisk_size=0x1000000"
c.进入guest os,在命令终端中输入ip a命令,发现PCIe网卡,并且配置名字为eth0,
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UPgroup default qlen 1000
link/ether 98:0e:24:3a:30:4e brd ff:ff:ff:ff:ff:ff
配置ip地址,设置网络:
ifconfig eth0 172.17.8.114 netmask 255.255.254.0
route add default gateway 172.17.8.253
d.使用下面命令测试是否可以正常访问网络:
ping www.baidu.com
打印出类似下面结果,表明PCIe网卡成功隔离给了jailhouse的non root cell
正在 Ping www.a.shifen.com [220.181.38.149]具有32字节的数据:
来自 220.181.38.149 的回复:字节=32 时间=25ms TTL=52
来自 220.181.38.149 的回复:字节=32 时间=6ms TTL=52
来自 220.181.38.149 的回复:字节=32 时间=9ms TTL=52
来自 220.181.38.149 的回复:字节=32 时间=10ms TTL=52
220.181.38.149 的 Ping 统计信息:
数据包:已发送=4,已接收=4,丢失=0(0%丢失),
往返行程的估计时间(以毫秒为单位):
最短 =6ms,最长=25ms,平均=12ms
因此,本发明通过修改主机的设备树、jailhouse non root cell的设备树,及jailhouse的配置文件,实现了在ARM64架构下,将物理PCIe网卡隔离给guest os的目的。
显然,所描述的实施例仅仅是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
Claims (1)
1.一种ARM64架构下基于jailhouse隔离PCIe网卡的方法,其特征在于,包括以下步骤:
S1、删除主机使用的设备树文件中的gic-its节点和PCIe节点;
S2、将S1中的gic-its节点和PCIe节点添加至jailhouse non root cell的设备树文件中,具体的,删除主机使用的设备树文件ft2004-devboard.dts中的gic-its节点和PCIe节点,从而将中断翻译服务和PCIe网卡设备从主机中移除;
S3、通过主机使用的设备树文件中的interrupt-controller节点中的reg属性,获取gic redistributor的内存地址和内存大小,具体的,通过主机使用的设备树ft2004-devboard.dts,获取interrupt-controller节点中的reg属性,从而获取reg属性中的第六个元素的值0x29980000,第八个元素的值0x80000,其分别表示gic redistributor的内存地址和内存大小;
S4、将gic redistributor的内存地址和内存大小添加到root cell和non root cell的配置文件中,具体的:
修改root cell的配置文件main.c,在mem_regions数组中添加如下内容,使得jailhouse root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO
};
修改non root cell的配置文件inmate.c,在mem_regions数组中添加如下内容,使得jailhouse non root cell对gic redistributor的地址可进行读写:
{
.phys_start=0x29980000,
.virt_start=0x29980000,
.size=0x80000,
.flags=JAILHOUSE_MEM_READ|JAILHOUSE_MEM_WRITE|JAILHOUSE_MEM_IO|JAILHOUSE_MEM_ROOTSHARED
};
S5、运行jailhouse,non root cell中的guest os正常使用PCIe网卡。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310492989.1A CN116204933B (zh) | 2023-05-05 | 2023-05-05 | 一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310492989.1A CN116204933B (zh) | 2023-05-05 | 2023-05-05 | 一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116204933A CN116204933A (zh) | 2023-06-02 |
CN116204933B true CN116204933B (zh) | 2023-09-26 |
Family
ID=86515028
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310492989.1A Active CN116204933B (zh) | 2023-05-05 | 2023-05-05 | 一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116204933B (zh) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116431293B (zh) * | 2023-06-14 | 2023-09-26 | 麒麟软件有限公司 | 一种在jailhouse实现PCIE设备隔离的方法 |
CN116719613B (zh) * | 2023-08-10 | 2023-10-31 | 麒麟软件有限公司 | 基于虚拟监控器实现Linux下PCIe物理设备隔离的方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114398144A (zh) * | 2021-12-06 | 2022-04-26 | 麒麟软件有限公司 | 基于X86平台使用QEMU搭建Jailhouse的方法 |
CN114398145A (zh) * | 2021-12-06 | 2022-04-26 | 麒麟软件有限公司 | 基于X86平台的Jailhouse运行non-root Linux的方法 |
CN115269057A (zh) * | 2022-09-23 | 2022-11-01 | 麒麟软件有限公司 | 基于设备树的隔离系统生成配置文件的方法 |
CN115599502A (zh) * | 2022-10-17 | 2023-01-13 | 麒麟软件有限公司(Cn) | 基于虚拟机监控器的rtos网络共享方法 |
CN115686889A (zh) * | 2023-01-04 | 2023-02-03 | 麒麟软件有限公司 | Jailhouse基于ACPI使用Ivshmem的方法 |
CN115794259A (zh) * | 2023-02-01 | 2023-03-14 | 麒麟软件有限公司 | 通过acpi生成设备树的方法 |
-
2023
- 2023-05-05 CN CN202310492989.1A patent/CN116204933B/zh active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114398144A (zh) * | 2021-12-06 | 2022-04-26 | 麒麟软件有限公司 | 基于X86平台使用QEMU搭建Jailhouse的方法 |
CN114398145A (zh) * | 2021-12-06 | 2022-04-26 | 麒麟软件有限公司 | 基于X86平台的Jailhouse运行non-root Linux的方法 |
CN115269057A (zh) * | 2022-09-23 | 2022-11-01 | 麒麟软件有限公司 | 基于设备树的隔离系统生成配置文件的方法 |
CN115599502A (zh) * | 2022-10-17 | 2023-01-13 | 麒麟软件有限公司(Cn) | 基于虚拟机监控器的rtos网络共享方法 |
CN115686889A (zh) * | 2023-01-04 | 2023-02-03 | 麒麟软件有限公司 | Jailhouse基于ACPI使用Ivshmem的方法 |
CN115794259A (zh) * | 2023-02-01 | 2023-03-14 | 麒麟软件有限公司 | 通过acpi生成设备树的方法 |
Also Published As
Publication number | Publication date |
---|---|
CN116204933A (zh) | 2023-06-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116204933B (zh) | 一种ARM64架构下基于jailhouse隔离PCIe网卡的方法 | |
US20210232528A1 (en) | Configurable device interface | |
US20180101494A1 (en) | Presenting multiple endpoints from an enhanced pci express endpoint device | |
JP4810349B2 (ja) | I/o装置及び方法 | |
US8726298B1 (en) | Cloud-based instrument driver system | |
CN113452830B (zh) | 安卓云手机的批量控制方法、计算机可读介质及电子设备 | |
US10684880B2 (en) | Allocating and initializing I/O devices at virtual | |
US20120254862A1 (en) | Efficent migration of virtual functions to enable high availability and resource rebalance | |
WO2020024413A1 (zh) | 一种云计算平台部署的控制方法、服务器及存储介质 | |
CN110995561B (zh) | 基于容器技术的虚拟网络数据通信交互方法与系统 | |
US9817747B2 (en) | Systems and methods for unit testing of functions on remote kernels | |
US10013388B1 (en) | Dynamic peer-to-peer configuration | |
US10360092B1 (en) | Hybrid hardware and software reporting management | |
CN112272177B (zh) | 一种批量部署蜜网诱捕节点的方法 | |
CN111104321A (zh) | 一种基于docker的云平台稳定性测试方法及系统 | |
WO2014086193A1 (en) | Data flow affinity for heterogenous virtual machines | |
CN110618822B (zh) | 无盘工作站启动阶段预安装网卡驱动的方法 | |
CN108259305A (zh) | 一种基于openstack的物理机远程虚拟局域网切换方法及装置 | |
US20230229481A1 (en) | Provisioning dpu management operating systems | |
US5968174A (en) | Method and apparatus for implementing a 32-bit operating system which supports 16-bit code | |
US10140227B1 (en) | Reducing read transactions to peripheral devices | |
CN112068892A (zh) | 一种基于uefi技术的无盘工作站启动方法 | |
US20120072907A1 (en) | Proxy tool for guest machine relocation | |
CN114024853B (zh) | 一种裸金属节点的硬件信息收集方法、系统及相关组件 | |
CN113886153A (zh) | 一种基于容器的网卡压力测试方法及装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |