EU countries have reached major deal on migration, asylum policy