Re: [RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver
On Mon, Aug 19, 2019 at 12:02:33PM +0800, Zhao, Yakui wrote: > > > On 2019年08月16日 15:05, Greg KH wrote: > > On Fri, Aug 16, 2019 at 10:25:45AM +0800, Zhao Yakui wrote: > > > ACRN hypervisor service module is the important middle layer that allows > > > the Linux kernel to communicate with the ACRN hypervisor. It includes > > > the management of virtualized CPU/memory/device/interrupt for other ACRN > > > guest. The user-space applications can use the provided ACRN ioctls to > > > interact with ACRN hypervisor through different hypercalls. > > > > > > Add one basic framework firstly and the following patches will > > > add the corresponding implementations, which includes the management of > > > virtualized CPU/memory/interrupt and the emulation of MMIO/IO/PCI access. > > > The device file of /dev/acrn_hsm can be accessed in user-space to > > > communicate with ACRN module. > > > > > > Co-developed-by: Jason Chen CJ > > > Signed-off-by: Jason Chen CJ > > > Co-developed-by: Jack Ren > > > Signed-off-by: Jack Ren > > > Co-developed-by: Mingqiang Chi > > > Signed-off-by: Mingqiang Chi > > > Co-developed-by: Liu Shuo > > > Signed-off-by: Liu Shuo > > > Signed-off-by: Zhao Yakui > > > --- > > > drivers/staging/Kconfig | 2 + > > > > Also, your subject line for all of these patches are wrong, it is not > > drivers/acrn :( > > Thanks for the pointing out it. > > It will be fixed. > > > > > And you forgot to cc: the staging maintainer :( > > Do you mean that the maintainer of staging subsystem is also added in the > patch commit log? Did you not run scripts/get_maintainer.pl on your patches to determine who to send patches to? Always do that. > > As I have said with NUMEROUS Intel patches in the past, I now refuse to > > take patches from you all WITHOUT having it signed-off-by someone from > > the Intel "OTC" group (or whatever the Intel Linux group is called these > > days). They are a resource you can not ignore, and if you do, you just > > end up making the rest of the kernel community grumpy by having us do > > their work for them :( > > > > Please work with them. > > OK. I will work with some peoples in OTC group to prepare the better ACRN > driver. Thank you. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver
On 2019年08月16日 15:05, Greg KH wrote: On Fri, Aug 16, 2019 at 10:25:45AM +0800, Zhao Yakui wrote: ACRN hypervisor service module is the important middle layer that allows the Linux kernel to communicate with the ACRN hypervisor. It includes the management of virtualized CPU/memory/device/interrupt for other ACRN guest. The user-space applications can use the provided ACRN ioctls to interact with ACRN hypervisor through different hypercalls. Add one basic framework firstly and the following patches will add the corresponding implementations, which includes the management of virtualized CPU/memory/interrupt and the emulation of MMIO/IO/PCI access. The device file of /dev/acrn_hsm can be accessed in user-space to communicate with ACRN module. Co-developed-by: Jason Chen CJ Signed-off-by: Jason Chen CJ Co-developed-by: Jack Ren Signed-off-by: Jack Ren Co-developed-by: Mingqiang Chi Signed-off-by: Mingqiang Chi Co-developed-by: Liu Shuo Signed-off-by: Liu Shuo Signed-off-by: Zhao Yakui --- drivers/staging/Kconfig | 2 + Also, your subject line for all of these patches are wrong, it is not drivers/acrn :( Thanks for the pointing out it. It will be fixed. And you forgot to cc: the staging maintainer :( Do you mean that the maintainer of staging subsystem is also added in the patch commit log? As I have said with NUMEROUS Intel patches in the past, I now refuse to take patches from you all WITHOUT having it signed-off-by someone from the Intel "OTC" group (or whatever the Intel Linux group is called these days). They are a resource you can not ignore, and if you do, you just end up making the rest of the kernel community grumpy by having us do their work for them :( Please work with them. OK. I will work with some peoples in OTC group to prepare the better ACRN driver. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver
On Fri, Aug 16, 2019 at 10:25:45AM +0800, Zhao Yakui wrote: > +static > +int acrn_dev_open(struct inode *inodep, struct file *filep) > +{ > + pr_info("%s: opening device node\n", __func__); > + > + return 0; > +} > + > +static > +long acrn_dev_ioctl(struct file *filep, > + unsigned int ioctl_num, unsigned long ioctl_param) > +{ > + long ret = 0; > + > + return ret; This module is mostly stubs and debugging printks... :( I looked ahead in the patch series to see if we do something with the stubs later on and it turns out we do. Fold the two patches together so that we don't have to review patches like this one. Each patch should do "one thing" which makes sense and can be reviewed independently. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver
On Fri, Aug 16, 2019 at 10:25:45AM +0800, Zhao Yakui wrote: > ACRN hypervisor service module is the important middle layer that allows > the Linux kernel to communicate with the ACRN hypervisor. It includes > the management of virtualized CPU/memory/device/interrupt for other ACRN > guest. The user-space applications can use the provided ACRN ioctls to > interact with ACRN hypervisor through different hypercalls. > > Add one basic framework firstly and the following patches will > add the corresponding implementations, which includes the management of > virtualized CPU/memory/interrupt and the emulation of MMIO/IO/PCI access. > The device file of /dev/acrn_hsm can be accessed in user-space to > communicate with ACRN module. > > Co-developed-by: Jason Chen CJ > Signed-off-by: Jason Chen CJ > Co-developed-by: Jack Ren > Signed-off-by: Jack Ren > Co-developed-by: Mingqiang Chi > Signed-off-by: Mingqiang Chi > Co-developed-by: Liu Shuo > Signed-off-by: Liu Shuo > Signed-off-by: Zhao Yakui > --- > drivers/staging/Kconfig | 2 + Also, your subject line for all of these patches are wrong, it is not drivers/acrn :( And you forgot to cc: the staging maintainer :( As I have said with NUMEROUS Intel patches in the past, I now refuse to take patches from you all WITHOUT having it signed-off-by someone from the Intel "OTC" group (or whatever the Intel Linux group is called these days). They are a resource you can not ignore, and if you do, you just end up making the rest of the kernel community grumpy by having us do their work for them :( Please work with them. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver
ACRN hypervisor service module is the important middle layer that allows the Linux kernel to communicate with the ACRN hypervisor. It includes the management of virtualized CPU/memory/device/interrupt for other ACRN guest. The user-space applications can use the provided ACRN ioctls to interact with ACRN hypervisor through different hypercalls. Add one basic framework firstly and the following patches will add the corresponding implementations, which includes the management of virtualized CPU/memory/interrupt and the emulation of MMIO/IO/PCI access. The device file of /dev/acrn_hsm can be accessed in user-space to communicate with ACRN module. Co-developed-by: Jason Chen CJ Signed-off-by: Jason Chen CJ Co-developed-by: Jack Ren Signed-off-by: Jack Ren Co-developed-by: Mingqiang Chi Signed-off-by: Mingqiang Chi Co-developed-by: Liu Shuo Signed-off-by: Liu Shuo Signed-off-by: Zhao Yakui --- drivers/staging/Kconfig | 2 + drivers/staging/Makefile| 1 + drivers/staging/acrn/Kconfig| 18 ++ drivers/staging/acrn/Makefile | 2 + drivers/staging/acrn/acrn_dev.c | 123 5 files changed, 146 insertions(+) create mode 100644 drivers/staging/acrn/Kconfig create mode 100644 drivers/staging/acrn/Makefile create mode 100644 drivers/staging/acrn/acrn_dev.c diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 7c96a01..0766de5 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -120,4 +120,6 @@ source "drivers/staging/kpc2000/Kconfig" source "drivers/staging/isdn/Kconfig" +source "drivers/staging/acrn/Kconfig" + endif # STAGING diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index fcaac96..f927eb0 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -49,4 +49,5 @@ obj-$(CONFIG_XIL_AXIS_FIFO) += axis-fifo/ obj-$(CONFIG_EROFS_FS) += erofs/ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_KPC2000) += kpc2000/ +obj-$(CONFIG_ACRN_HSM) += acrn/ obj-$(CONFIG_ISDN_CAPI)+= isdn/ diff --git a/drivers/staging/acrn/Kconfig b/drivers/staging/acrn/Kconfig new file mode 100644 index 000..a047d5f --- /dev/null +++ b/drivers/staging/acrn/Kconfig @@ -0,0 +1,18 @@ +config ACRN_HSM + tristate "Intel ACRN Hypervisor service Module" + depends on ACRN_GUEST + depends on HUGETLBFS + depends on PCI_MSI + default n + help + This is the Hypervisor service Module (ACRN.ko) for ACRN guest + to communicate with ACRN hypervisor. It includes the management + of virtualized CPU/memory/device/interrupt for other ACRN guest. + + It is required if it needs to manage other ACRN guests. User-guest + OS does not need it. + + If unsure, say N. + If you wish to work on this driver, to help improve it, or to + report problems you have with them, please use the + acrn-...@lists.projectacrn.org mailing list. diff --git a/drivers/staging/acrn/Makefile b/drivers/staging/acrn/Makefile new file mode 100644 index 000..48fca38 --- /dev/null +++ b/drivers/staging/acrn/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_ACRN_HSM) := acrn.o +acrn-y := acrn_dev.o diff --git a/drivers/staging/acrn/acrn_dev.c b/drivers/staging/acrn/acrn_dev.c new file mode 100644 index 000..55a7612 --- /dev/null +++ b/drivers/staging/acrn/acrn_dev.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +/* + * ACRN hyperviosr service module (HSM): main framework + * + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * Jason Chen CJ + * Zhao Yakui + * Jack Ren + * Mingqiang Chi + * Liu Shuo + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEVICE_NAME "acrn_hsm" +#define CLASS_NAME "acrn" + +static int acrn_hsm_inited; +static int major; +static struct class*acrn_class; +static struct device *acrn_device; + +static +int acrn_dev_open(struct inode *inodep, struct file *filep) +{ + pr_info("%s: opening device node\n", __func__); + + return 0; +} + +static +long acrn_dev_ioctl(struct file *filep, + unsigned int ioctl_num, unsigned long ioctl_param) +{ + long ret = 0; + + return ret; +} + +static int acrn_dev_release(struct inode *inodep, struct file *filep) +{ + return 0; +} + +static const struct file_operations fops = { + .open = acrn_dev_open, + .release = acrn_dev_release, + .unlocked_ioctl = acrn_dev_ioctl, +}; + +#define EAX_PRIVILEGE_VM BIT(0) + +static int __init acrn_init(void) +{ + acrn_hsm_inited = 0; + if (x86_hyper_type != X86_HYPER_ACRN) + return -ENODEV; + + if (!(cpuid_eax(0x4001) & EAX_PRIVILEGE_VM)) + return -EPERM; + + /* Try to dynamically allocate a major number for the device */ + major =