[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171114180036.262eff80.cohuck@redhat.com>
Date: Tue, 14 Nov 2017 18:00:36 +0100
From: Cornelia Huck <cohuck@...hat.com>
To: Tony Krowiak <akrowiak@...ux.vnet.ibm.com>
Cc: linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, freude@...ibm.com, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com, borntraeger@...ibm.com,
kwankhede@...dia.com, bjsdjshi@...ux.vnet.ibm.com,
pbonzini@...hat.com, alex.williamson@...hat.com,
pmorel@...ux.vnet.ibm.com, alifm@...ux.vnet.ibm.com,
mjrosato@...ux.vnet.ibm.com, qemu-s390x@...gnu.org,
jjherne@...ux.vnet.ibm.com, thuth@...hat.com,
pasic@...ux.vnet.ibm.com
Subject: Re: [RFC 05/19] s390/zcrypt: base implementation of AP matrix
device driver
On Tue, 14 Nov 2017 11:37:05 -0500
Tony Krowiak <akrowiak@...ux.vnet.ibm.com> wrote:
> On 11/14/2017 07:40 AM, Cornelia Huck wrote:
> > On Fri, 13 Oct 2017 13:38:50 -0400
> > Tony Krowiak <akrowiak@...ux.vnet.ibm.com> wrote:
> >> diff --git a/drivers/s390/crypto/ap_matrix_bus.c b/drivers/s390/crypto/ap_matrix_bus.c
> >> index 4eb1e3c..66bfa54 100644
> >> --- a/drivers/s390/crypto/ap_matrix_bus.c
> >> +++ b/drivers/s390/crypto/ap_matrix_bus.c
> >> @@ -75,10 +75,18 @@ static int ap_matrix_dev_create(void)
> >> return 0;
> >> }
> >>
> >> +struct ap_matrix *ap_matrix_get_device(void)
> >> +{
> >> + return matrix;
> > See the comments I had for the previous patch. In particular, I think
> > it is better to retrieve a pointer to the matrix device via driver core
> > methods.
> I got some objections to creating a new bus and since there will only ever
> be a single AP matrix device, I decided there really wasn't a need for an
> AP matrix bus and got rid of it. I opted instead to create the matrix
> device
> in the init function of the vfio_ap_matrix driver. Rather than passing
> around a
> pointer, I put the following in vfio_ap_matrix_private.h:
>
> struct ap_matrix {
> struct device device;
> spinlock_t qlock;
> struct list_head queues;
> };
>
> extern struct ap_matrix ap_matrix;
>
> ... and declared the ap_matrix in the driver (vfio_ap_matrix_drv.c)
> file as:
>
> struct ap_matrix ap_matrix;
>
> Does this seem like a reasonable approach?
Getting rid of the bus as overhead is not unreasonable.
I'm feeling a bit queasy about the extern, however. I'd prefer a getter
function (that also makes sure refcounting rules are followed).
We can't get around referencing this device from multiple files, can we?
Powered by blists - more mailing lists