It's always been the (EU) rule that anyone staying more than 90 days should register and get temporary residency ( which can be made permanent after 5 years). But not all countries bothered (I think Germany and Belgium did - and you get a telling off if found out).
We realised that there could be problems and applied shortly after the referendum. In Portugal you do it at your local Camara ( Town Hall) and it costs about 20 Euros. In Portugal you also have to have a Fiscal Number ( like our NI number) and this costs about E10
It was a simple process and took about 10 days. We're glad we did and I suspect that thousands more motorhomers in Iberia will do so in the future.